id
int64
0
458k
file_name
stringlengths
4
119
file_path
stringlengths
14
227
content
stringlengths
24
9.96M
size
int64
24
9.96M
language
stringclasses
1 value
extension
stringclasses
14 values
total_lines
int64
1
219k
avg_line_length
float64
2.52
4.63M
max_line_length
int64
5
9.91M
alphanum_fraction
float64
0
1
repo_name
stringlengths
7
101
repo_stars
int64
100
139k
repo_forks
int64
0
26.4k
repo_open_issues
int64
0
2.27k
repo_license
stringclasses
12 values
repo_extraction_date
stringclasses
433 values
19,600
mod.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/mod.pyc
Ñò Î ÈMc @s‹dZddklZddklZddklZlZlZl Z l Z l Z l Z ddk lZlZddklZddklZh d,d 6d-d 6d.d 6d/d6d0d6d1d6d2d6d3d6d4d6d5d6d6d6d7d6d8d6Zd„Zd„Zdefd „ƒYZd!efd"„ƒYZd#efd$„ƒYZd%efd&„ƒYZd'efd(„ƒYZd)efd*„ƒYZd+S(9sY Parser of FastTrackerII Extended Module (XM) version 1.4 Documents: - Modplug source code (file modplug/soundlib/Load_mod.cpp) http://sourceforge.net/projects/modplug - Dumb source code (files include/dumb.h and src/it/readmod.c http://dumb.sf.net/ - Documents on "MOD" format on Wotsit http://www.wotsit.org Compressed formats (i.e. starting with "PP20" or having "PACK" as type are not handled. Also NoiseTracker's NST modules aren't handled, although it might be possible: no file format and 15 samples Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 18th February 2007 iÿÿÿÿ(tlog10(tParser(tFieldSettBitstUInt16tUInt8tRawBytestStringt GenericVector(t LITTLE_ENDIANt BIG_ENDIAN(t textHandler(t NOTE_NAMEsNoise/Pro-TrackerisM.K.sM!K!sM&K&t StarTrekkertRASPtFLT4itFLT8t FastTrackerit6CHNt8CHNt OctalysertCD81tOCTAsDigital TrackertFA04tFA06tFA08cCs d|iS(Nt0t1t2t3t4t5t6t7t8s-8s-7s-6s-5s-4s-3s-2s-1(RRRRRRR R!R"s-8s-7s-6s-5s-4s-3s-2s-1(tvalue(tval((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyt getFineTune.scCsddt|idƒS(Ns%.1f dBg4@gP@(RR#(R$((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyt getVolume2st SampleInfocBs eZdZd„Zd„ZRS(iiccsyt|ddddƒVt|dƒVtt|dƒtƒVtt|dƒtƒVt|dd ƒVt|d d ƒVdS( Ntnameitstriptt sample_countt fine_tunetvolumet loop_startsLoop start offset in samplestloop_lensLoop length in samples(RRR RR%R&(tself((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyt createFields7s cCs |diS(NR((R#(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyt createValue?sið(t__name__t __module__t static_sizeR1R2(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR'5s tHeadercBs eZdZd„Zd„ZRS(i<iccsvt|ddddƒVt|ddtdƒVt|dƒVt|d ƒVt|d d td ƒVt|d dƒVdS(NR(iR)R*tsamplesitinfotlengthtplayed_patterns_counttpatternsi€tpositionttypei(RRR'R(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR1Es cCst|didS(NR=i(t MODULE_TYPER#(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pytgetNumChannelsMsià!(R3R4R5R1R?(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR6Bs tNotecBseZdZd„ZRS(iiccsVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|dƒVdS(Nitnote_hi_nibblei tperiodtnote_low_nibbleteffectt parameter(RR(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR1Rs i (R3R4R5R1(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR@PstRowcBseZdd„Zd„ZRS(cCs:ti|||d|ƒ||_d|id|_dS(Nt descriptionii(Rt__init__tchannelst_size(R0tparentR(RItdesc((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyRHZs ccs,x%t|iƒD]}t|dƒVqWdS(Nsnote[](txrangeRIR@(R0tindex((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR1_sN(R3R4tNoneRHR1(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyRFYs tPatterncBseZdd„Zd„ZRS(cCs:ti|||d|ƒ||_d|id|_dS(NRGi@iii(RRHRIRJ(R0RKR(RIRL((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyRHds ccs/x(tdƒD]}t|d|iƒVq WdS(Ni@srow[](RMRFRI(R0RN((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR1is N(R3R4RORHR1(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyRPcs t AmigaModulecBsPeZhdd6dd6dd6dd 6dd6dd6ZeZd„Zd„ZRS(tmodtidtaudiotcategorytnsttwowtocttsd0tfile_extu audio/modu audio/x-modtmimei<itmin_sizesUncompressed amiga moduleRGcCs;|iiddƒ}|tjo d|Sd„|_tS(Ni8iisInvalid module type '%s'cSs dt|S(s%s module, %u channels(R>(tt((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyt<lambda>|siÀ!(tstreamt readBytesR>R2tTrue(R0R]((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pytvalidatexs    c csót|dƒ}|V|iƒ}d}x.tdƒD] }t||d|iƒ}q3W|d7}x%t|ƒD]}t|d|ƒVqnWxctdƒD]U}|d|i}|o7|id ||fƒt|d d |d |ƒVq–q–WdS( Ntheaderii€spatterns/position[%u]is pattern[]issamples/info[%u]/sample_countsYielding sample %u: %u sampless sample_data[]is Sample %u(R6R?RMtmaxR#RPR8R(R0RcRIR;RNtcount((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyR1s&     (smodRVRWsoctRY(u audio/modu audio/x-modu audio/modu audio/x-modià!(R3R4t PARSER_TAGSR tendianRbR1(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyRQms  N(sNoise/Pro-Trackeri(sNoise/Pro-Trackeri(sNoise/Pro-Trackeri(R i(R i(R i(Ri(Ri(Ri(Ri(sDigital Trackeri(sDigital Trackeri(sDigital Trackeri(t__doc__tmathRthachoir_parserRthachoir_core.fieldRRRRRRRthachoir_core.endianR R thachoir_core.text_handlerR thachoir_parser.common.trackerR R>R%R&R'R6R@RFRPRQ(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mod.pyt<module>s84      
8,251
Python
.py
34
241.382353
2,367
0.470903
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,601
itunesdb.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/itunesdb.py
""" iPod iTunesDB parser. Documentation: - http://ipodlinux.org/ITunesDB Author: Romain HERAULT Creation date: 19 august 2006 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt8, UInt16, UInt32, UInt64, TimestampMac32, String, Float32, NullBytes, Enum) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.tools import humanDuration from hachoir_core.text_handler import displayHandler, filesizeHandler list_order={ 1 : "playlist order (manual sort order)", 2 : "???", 3 : "songtitle", 4 : "album", 5 : "artist", 6 : "bitrate", 7 : "genre", 8 : "kind", 9 : "date modified", 10 : "track number", 11 : "size", 12 : "time", 13 : "year", 14 : "sample rate", 15 : "comment", 16 : "date added", 17 : "equalizer", 18 : "composer", 19 : "???", 20 : "play count", 21 : "last played", 22 : "disc number", 23 : "my rating", 24 : "release date", 25 : "BPM", 26 : "grouping", 27 : "category", 28 : "description", 29 : "show", 30 : "season", 31 : "episode number" } class DataObject(FieldSet): type_name={ 1:"Title", 2:"Location", 3:"Album", 4:"Artist", 5:"Genre", 6:"Filetype", 7:"EQ Setting", 8:"Comment", 9:"Category", 12:"Composer", 13:"Grouping", 14:"Description text", 15:"Podcast Enclosure URL", 16:"Podcast RSS URL", 17:"Chapter data", 18:"Subtitle", 19:"Show (for TV Shows only)", 20:"Episode", 21:"TV Network", 50:"Smart Playlist Data", 51:"Smart Playlist Rules", 52:"Library Playlist Index", 100:"Column info", } mhod52_sort_index_type_name={ 3:"Title", 4:"Album, then Disk/Tracknumber, then Title", 5:"Artist, then Album, then Disc/Tracknumber, then Title", 7:"Genre, then Artist, then Album, then Disc/Tracknumber, then Title", 8:"Composer, then Title" } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["entry_length"].value *8 def createFields(self): yield String(self, "header_id", 4, "Data Object Header Markup (\"mhod\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "entry_length", "Entry Length") yield Enum(UInt32(self, "type", "type"),self.type_name) if(self["type"].value<15): yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "position", "Position") yield UInt32(self, "length", "String Length in bytes") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield String(self, "string", self["length"].value, "String Data", charset="UTF-16-LE") elif (self["type"].value<17): yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield String(self, "string", self._size/8-self["header_length"].value, "String Data", charset="UTF-8") elif (self["type"].value == 52): yield UInt32(self, "unknown[]", "unk1") yield UInt32(self, "unknown[]", "unk2") yield Enum(UInt32(self, "sort_index_type", "Sort Index Type"),self.mhod52_sort_index_type_name) yield UInt32(self, "entry_count", "Entry Count") indexes_size = self["entry_count"].value*4 padding_offset = self["entry_length"].value - indexes_size padding = self.seekByte(padding_offset, "header padding") if padding: yield padding for i in xrange(self["entry_count"].value): yield UInt32(self, "index["+str(i)+"]", "Index of the "+str(i)+"nth mhit") else: padding = self.seekByte(self["header_length"].value, "header padding") if padding: yield padding padding = self.seekBit(self._size, "entry padding") if padding: yield padding class TrackItem(FieldSet): x1_type_name={ 0:"AAC or CBR MP3", 1:"VBR MP3" } x2_type_name={ 0:"AAC", 1:"MP3" } media_type_name={ 0x00:"Audio/Video", 0x01:"Audio", 0x02:"Video", 0x04:"Podcast", 0x06:"Video Podcast", 0x08:"Audiobook", 0x20:"Music Video", 0x40:"TV Show", 0X60:"TV Show (Music lists)", } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["entry_length"].value *8 def createFields(self): yield String(self, "header_id", 4, "Track Item Header Markup (\"mhit\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "entry_length", "Entry Length") yield UInt32(self, "string_number", "Number of Strings") yield UInt32(self, "unique_id", "Unique ID") yield UInt32(self, "visible_tag", "Visible Tag") yield String(self, "file_type", 4, "File Type") yield Enum(UInt8(self, "x1_type", "Extended Type 1"),self.x1_type_name) yield Enum(UInt8(self, "x2_type", "Extended type 2"),self.x2_type_name) yield UInt8(self, "compilation_flag", "Compilation Flag") yield UInt8(self, "rating", "Rating") yield TimestampMac32(self, "added_date", "Date when the item was added") yield filesizeHandler(UInt32(self, "size", "Track size in bytes")) yield displayHandler(UInt32(self, "length", "Track length in milliseconds"), humanDuration) yield UInt32(self, "track_number", "Number of this track") yield UInt32(self, "total_track", "Total number of tracks") yield UInt32(self, "year", "Year of the track") yield UInt32(self, "bitrate", "Bitrate") yield UInt32(self, "samplerate", "Sample Rate") yield UInt32(self, "volume", "volume") yield UInt32(self, "start_time", "Start playing at, in milliseconds") yield UInt32(self, "stop_time", "Stop playing at, in milliseconds") yield UInt32(self, "soundcheck", "SoundCheck preamp") yield UInt32(self, "playcount_1", "Play count of the track") yield UInt32(self, "playcount_2", "Play count of the track (identical to playcount_1)") yield UInt32(self, "last_played_time", "Time the song was last played") yield UInt32(self, "disc_number", "disc number in multi disc sets") yield UInt32(self, "total_discs", "Total number of discs in the disc set") yield UInt32(self, "userid", "User ID in the DRM scheme") yield TimestampMac32(self, "last_modified", "Time of the last modification of the track") yield UInt32(self, "bookmark_time", "Bookmark time for AudioBook") yield UInt64(self, "dbid", "Unique DataBase ID for the song (identical in mhit and in mhii)") yield UInt8(self, "checked", "song is checked") yield UInt8(self, "application_rating", "Last Rating before change") yield UInt16(self, "BPM", "BPM of the track") yield UInt16(self, "artwork_count", "number of artworks fo this item") yield UInt16(self, "unknown[]") yield UInt32(self, "artwork_size", "Total size of artworks in bytes") yield UInt32(self, "unknown[]") yield Float32(self, "sample_rate_2", "Sample Rate express in float") yield UInt32(self, "released_date", "Date of release in Music Store or in Podcast") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt8(self, "has_artwork", "0x01 for track with artwork, 0x02 otherwise") yield UInt8(self, "skip_wen_shuffling", "Skip that track when shuffling") yield UInt8(self, "remember_playback_position", "Remember playback position") yield UInt8(self, "flag4", "Flag 4") yield UInt64(self, "dbid2", "Unique DataBase ID for the song (identical as above)") yield UInt8(self, "lyrics_flag", "Lyrics Flag") yield UInt8(self, "movie_file_flag", "Movie File Flag") yield UInt8(self, "played_mark", "Track has been played") yield UInt8(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "sample_count", "Number of samples in the song (only for WAV and AAC files)") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield Enum(UInt32(self, "media_type", "Media Type for video iPod"),self.media_type_name) yield UInt32(self, "season_number", "Season Number") yield UInt32(self, "episode_number", "Episode Number") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") padding = self.seekByte(self["header_length"].value, "header padding") if padding: yield padding #while ((self.stream.readBytes(0, 4) == 'mhod') and ((self.current_size/8) < self["entry_length"].value)): for i in xrange(self["string_number"].value): yield DataObject(self, "data[]") padding = self.seekBit(self._size, "entry padding") if padding: yield padding class TrackList(FieldSet): def createFields(self): yield String(self, "header_id", 4, "Track List Header Markup (\"mhlt\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "track_number", "Number of Tracks") padding = self.seekByte(self["header_length"].value, "header padding") if padding: yield padding for i in xrange(self["track_number"].value): yield TrackItem(self, "track[]") class PlaylistItem(FieldSet): def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["entry_length"].value *8 def createFields(self): yield String(self, "header_id", 4, "Playlist Item Header Markup (\"mhip\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "entry_length", "Entry Length") yield UInt32(self, "data_object_child_count", "Number of Child Data Objects") yield UInt32(self, "podcast_grouping_flag", "Podcast Grouping Flag") yield UInt32(self, "group_id", "Group ID") yield UInt32(self, "track_id", "Track ID") yield TimestampMac32(self, "timestamp", "Song Timestamp") yield UInt32(self, "podcast_grouping_ref", "Podcast Grouping Reference") padding = self.seekByte(self["header_length"].value, "header padding") if padding: yield padding for i in xrange(self["data_object_child_count"].value): yield DataObject(self, "mhod[]") class Playlist(FieldSet): is_master_pl_name={ 0:"Regular playlist", 1:"Master playlist" } is_podcast_name={ 0:"Normal Playlist List", 1:"Podcast Playlist List" } list_sort_order_name={ 1:"Manual Sort Order", 2:"???", 3:"Song Title", 4:"Album", 5:"Artist", 6:"Bitrate", 7:"Genre", 8:"Kind", 9:"Date Modified", 10:"Track Number", 11:"Size", 12:"Time", 13:"Year", 14:"Sample Rate", 15:"Comment", 16:"Date Added", 17:"Equalizer", 18:"Composer", 19:"???", 20:"Play Count", 21:"Last Played", 22:"Disc Number", 23:"My Rating", 24:"Release Date", 25:"BPM", 26:"Grouping", 27:"Category", 28:"Description", 29:"Show", 30:"Season", 31:"Episode Number" } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["entry_length"].value *8 def createFields(self): yield String(self, "header_id", 4, "Playlist List Header Markup (\"mhyp\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "entry_length", "Entry Length") yield UInt32(self, "data_object_child_count", "Number of Child Data Objects") yield UInt32(self, "playlist_count", "Number of Playlist Items") yield Enum(UInt8(self, "type", "Normal or master playlist?"), self.is_master_pl_name) yield UInt8(self, "XXX1", "XXX1") yield UInt8(self, "XXX2", "XXX2") yield UInt8(self, "XXX3", "XXX3") yield TimestampMac32(self, "creation_date", "Date when the playlist was created") yield UInt64(self, "playlistid", "Persistent Playlist ID") yield UInt32(self, "unk3", "unk3") yield UInt16(self, "string_mhod_count", "Number of string MHODs for this playlist") yield Enum(UInt16(self, "is_podcast", "Playlist or Podcast List?"), self.is_podcast_name) yield Enum(UInt32(self, "sort_order", "Playlist Sort Order"), self.list_sort_order_name) padding = self.seekByte(self["header_length"].value, "entry padding") if padding: yield padding for i in xrange(self["data_object_child_count"].value): yield DataObject(self, "mhod[]") for i in xrange(self["playlist_count"].value): yield PlaylistItem(self, "playlist_item[]") class PlaylistList(FieldSet): def createFields(self): yield String(self, "header_id", 4, "Playlist List Header Markup (\"mhlp\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "playlist_number", "Number of Playlists") padding = self.seekByte(self["header_length"].value, "header padding") if padding: yield padding for i in xrange(self["playlist_number"].value): yield Playlist(self, "playlist[]") class DataSet(FieldSet): type_name={ 1:"Track List", 2:"Play List", 3:"Podcast List" } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["entry_length"].value *8 def createFields(self): yield String(self, "header_id", 4, "DataSet Header Markup (\"mhsd\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "entry_length", "Entry Length") yield Enum(UInt32(self, "type", "type"),self.type_name) padding = self.seekByte(self["header_length"].value, "header_raw") if padding: yield padding if self["type"].value == 1: yield TrackList(self, "tracklist[]") if self["type"].value == 2: yield PlaylistList(self, "playlist_list[]"); if self["type"].value == 3: yield PlaylistList(self, "podcast_list[]"); padding = self.seekBit(self._size, "entry padding") if padding: yield padding class DataBase(FieldSet): def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["entry_length"].value *8 # def createFields(self): class ITunesDBFile(Parser): PARSER_TAGS = { "id": "itunesdb", "category": "audio", "min_size": 44*8, "magic": (('mhbd',0),), "description": "iPod iTunesDB file" } endian = LITTLE_ENDIAN def validate(self): return self.stream.readBytes(0, 4) == 'mhbd' def createFields(self): yield String(self, "header_id", 4, "DataBase Header Markup (\"mhbd\")", charset="ISO-8859-1") yield UInt32(self, "header_length", "Header Length") yield UInt32(self, "entry_length", "Entry Length") yield UInt32(self, "unknown[]") yield UInt32(self, "version_number", "Version Number") yield UInt32(self, "child_number", "Number of Children") yield UInt64(self, "id", "ID for this database") yield UInt32(self, "unknown[]") yield UInt64(self, "initial_dbid", "Initial DBID") size = self["header_length"].value-self.current_size/ 8 if size>0: yield NullBytes(self, "padding", size) for i in xrange(self["child_number"].value): yield DataSet(self, "dataset[]") padding = self.seekByte(self["entry_length"].value, "entry padding") if padding: yield padding def createContentSize(self): return self["entry_length"].value * 8
17,086
Python
.py
392
34.859694
115
0.596109
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,602
id3.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/id3.pyc
—Ú Œ »Mc@s©dZddklZlZlZlZlZlZlZl Z l Z l Z l Z l Z lZlZddklZddklZddklZdefdÑÉYZdÑZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZ de fdÑÉYZ!defdÑÉYZ"dS( s{ ID3 metadata parser, supported versions: 1.O, 2.2, 2.3 and 2.4 Informations: http://www.id3.org/ Author: Victor Stinner iˇˇˇˇ(tFieldSett MatchErrort ParserErrortEnumtUInt8tUInt24tUInt32tCStringtStringtRawBytestBittBitst NullBytestNullBits(t textHandler(t humanDuration(tNETWORK_ENDIANtID3v1cBs;eZd+Zhîdd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6d[d\6d]d^6d_d`6dadb6dcdd6dedf6dgdh6didj6dkdl6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|6d}d~6ddÄ6dÅdÇ6dÉdÑ6dÖdÜ6dádà6dâdä6dãdå6dçdé6dèdê6dëdí6dìdî6dïdñ6dódò6dôdö6dõdú6dùdû6düd†6d°d¢6d£d§6d•d¶6dßd®6d©d™6d´d¨6d≠dÆ6dØd∞6d±d≤6d≥d¥6dµd∂6d∑d∏6dπd∫6dªdº6dΩdæ6død¿6d¡d¬6d√dƒ6d≈d∆6d«d»6d…d 6dÀdÃ6dÕdŒ6dœd–6d—d“6d”d‘6d’d÷6d◊dÿ6dŸd⁄6d€d‹6d›dfi6dfld‡6d·d‚6d„d‰6dÂdÊ6dÁdË6dÈdÍ6dÎdÏ6dÌdÓ6dÔd6dÒdÚ6dÛdÙ6dıdˆ6d˜d¯6d˘d˙6d˚d¸6d˝d˛6dˇd6dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6Zd(ÑZd)ÑZd*ÑZRS(,iÄiuBluesiu Classic RockiuCountryiuDanceiuDiscoiuFunkiuGrungeiuHip-HopiuJazzuMetali uNew Agei uOldiesi uOtheri uPopi uR&BiuRapiuReggaeiuRockiuTechnoiu Industrialiu AlternativeiuSkaiu Death MetaliuPranksiu Soundtrackiu Euro-TechnoiuAmbientiuTrip-HopiuVocaliu Jazz+FunkiuFusioniuTranceiu Classicali u Instrumentali!uAcidi"uHousei#uGamei$u Sound Clipi%uGospeli&uNoisei'u AlternRocki(uBassi)uSouli*uPunki+uSpacei,u Meditativei-uInstrumental Popi.uInstrumental Rocki/uEthnici0uGothici1uDarkwavei2uTechno-Industriali3u Electronici4uPop-Folki5u Eurodancei6uDreami7u Southern Rocki8uComedyi9uCulti:uGangstai;uTop 40i<u Christian Rapi=uPop/Funki>uJunglei?uNative Americani@uCabaretiAuNew WaveiBu PsychadeliciCuRaveiDu ShowtunesiEuTraileriFuLo-FiiGuTribaliHu Acid PunkiIu Acid JazziJuPolkaiKuRetroiLuMusicaliMu Rock & RolliNu Hard RockiOuFolkiPu Folk-RockiQu National FolkiRuSwingiSu Fast FusioniTuBebobiUuLatiniVuRevivaliWuCelticiXu BluegrassiYu AvantgardeiZu Gothic Rocki[uProgressive Rocki\uPsychedelic Rocki]uSymphonic Rocki^u Slow Rocki_uBig Bandi`uChorusiauEasy ListeningibuAcousticicuHumouriduSpeechieuChansonifuOperaigu Chamber MusicihuSonataiiuSymphonyiju Booty BassikuPrimusilu Porn GrooveimuSatireinuSlow JamiouClubipuTangoiquSambairuFolkloreisuBalladitu Power Balladiuu Rhythmic Soulivu FreestyleiwuDuetixu Punk Rockiyu Drum Soloizu A capellai{u Euro-Housei|u Dance Halli}uGoai~u Drum & Bassiu Club-HouseuHardcoreiÅuTerroriÇuIndieiÉuBritpopiÑu NegerpunkiÖu Polsk PunkiÜuBeatiáuChristian Gangsta Rapiàu Heavy Metaliâu Black Metaliäu CrossoveriãuContemporary ChristianiåuChristian Rock içuMerengueiéuSalsaièu Trash MetaliêuAnimeiëuJPopiíuSynthpopiìc cs~t|dddddÉV|didjotdÉÇnt|dd d d d dd ÉVt|dd dd d dd ÉVt|dd dd d dd ÉVt|dddd d dd ÉV|iÉ}|djoÉ|djo5t|dddd d dd ÉVt|ddÉVn!t|dd dd d dd ÉVtt|ddÉ|iÉVn!t|dddd d dd ÉVdS( Nt signatureisIDv1 signature ("TAG")tcharsettASCIItTAGs1Stream doesn't look like ID3v1 (wrong signature)!tsongis Song titletstrips s ISO-8859-1tauthortAuthortalbums Album titletyearitYearsv1.1sv1.1btcommentitCommentttrack_nbs Track numbertgenretGenrei(sv1.1sv1.1b(RtvalueRt getVersionRRt GENRE_NAME(tselftversion((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyt createFields´s         !cCsY|id }|ii|dÉ}|ddjo|ddjodSdSnd SdS( Ni~iiit isv1.1sv1.1bs1.0i(tabsolute_addresststreamt readBytes(R%taddrtbytes((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR#ƒs cCs+|iÉ}d||di|difS(NsID 3%s: author=%s, song=%sRR(R#R"(R%R&((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pytcreateDescription“s i(t__name__t __module__t static_sizeR$R'R#R.(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRs2   cCsBy|i}ti|SWn#tj otd|ÉÇnXdS(NsID3v2: Invalid charset (%s).(R"tID3_StringCharsett charset_nametKeyErrorR(tfieldtkey((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyt getCharset◊s  t ID3_StringcBseZdZdÑZRS(s c cs.t|d|iddddd|iÉVdS(NttextitTextRs ISO-8859-1R(Rt_sizetSTRIP(R%((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'‡s(R/R0R<R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR8fisR2cBs[eZdZhdd6dd6dd6dd6Zhdd6d d6d d6dd6Zd ÑZRS( s s ISO-8859-1isUTF-16 with BOMisUTF-16 (big endian)isUTF-8isUTF-16s UTF-16-BEc csqtt|dÉ|iÉV|i|id}|pdSt|dÉ}t|d|dd|d|iÉVdS(NRiR9R:R(RRt charset_desctsizet current_sizeR7RR<(R%R>R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'Òs (R/R0R<R=R3R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR2„s  t ID3_CommentcBseZdÑZRS(c cs´tt|dÉ|iÉVt|dddddÉVt|dÉ}t|ddd|d|iÉV|i|id }|pdSt|d |d d|d|iÉVdS( NRtlangitLanguageRttitletTitleRiR9R:( RRR=RR7RR<R>R?(R%RR>((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'˚s (R/R0R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR@˙stID3_StringTitlecBseZdÑZRS(c cs©tt|dÉ|iÉV|i|ijodSt|dÉ}t|ddd|d|iÉV|i|id}|pdSt|d|dd|d|iÉVdS(NRRCRDRiR9R:( RRR=R?R>R7RR<R(R%RR>((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR's (R/R0R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyREst ID3_PrivatecBseZdÑZRS(ccsf|id}|ii|idÉdjo"t|dddÉV|d8}nt|d|dÉVdS(Nii t PeakValueR9R:tcontenttContent(R;R*R+R)R(R%R>((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR's  (R/R0R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRFstID3_TrackLengthcBseZdÑZdÑZRS(ccsFt|ddÉVtt|d|idddddÉ|iÉVdS(Ntzeroitlengthis Length in msRR(R RRR;t computeLength(R%((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'scCs/yt|iÉ}t|ÉSWn |iSXdS(N(tintR"R(R%R5tms((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRM s (R/R0R'RM(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRJs t ID3_Picture23cBs™eZhdd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6Zd*ÑZRS(+tOtheris#32x32 pixels 'file icon' (PNG only)isOther file iconis Cover (front)is Cover (back)is Leaflet pageisMedia (e.g. lable side of CD)is"Lead artist/lead performer/soloistisArtist/performerit Conductori sBand/Orchestrai tComposeri sLyricist/text writeri sRecording Locationi sDuring recordingisDuring performanceisMovie/video screen captureisA bright coloured fishit IllustrationisBand/artist logotypeisPublisher/Studio logotypeiccs¨tt|dÉtiÉVt|dÉ}t|ddddÉVtt|dÉ|iÉVt|ddd|dd ÉV|i|i d }|ot |d |ÉVndS( NRtimg_fmtiRt pict_typeR9R:Rs itimg_data( RRR2R=R7Rtpict_type_nameRR;t _current_sizeR (R%RR>((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'?s(R/R0RXR'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRP's. t ID3_Picture24cBseZdÑZRS(ccs£tt|dÉtiÉVt|dÉ}t|ddd|ÉVtt|dÉtiÉVt|dd|ÉV|i|i d}|ot |d|ÉVndS(NRtmimes MIME typeRVt descriptioniRW( RRR2R=R7RRPRXR;RYR (R%RR>((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'Js(R/R0R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRZIst ID3_ChunkcBs"eZeZh dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6Zhdd6dd6dd6dd6d d6dd6d d6dd6dd6dd 6d!d"6dd#6d$d%6dd&6d'd(6Zhed6ed6ed6ed)6e d6e d*6e d+6e d(6Z d,ÑZ d-ÑZd.ÑZRS(/s Track titletTT2tArtisttTP1s Track numbertTRKRtCOMRStTCMtAlbumtTALRtTYEtEncodertTENs Content typetTCOtPicturetPICtCOMMtPrivatetPRIVtTPE1t CopyrighttTCOPtTALBtTENCtTYERsEncoder settingstTSSEtTCOMtTRCKs Play countertPCNTtTCONs Track lengthtTLENtTIT2sUser defined URLtWXXXtAPICtTXXXtWOARcGs\ti||åd|dijod|did|_n|didd|_dS(Nis ../ver_majori R>ii(Rt__init__R"R;(R%targs((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRÄ~sc csd|dijott|ddddddd ÉtiÉVd|dijot|d ÉVnt|d ÉVt|d d ÉVt|d d ÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉV|d i}|di}n]tt|ddddddd Éti ÉVt |d ÉV|d i|i dd}t }|oòd}|pM|di}|tijoti|}q◊|ddjo t}q◊n|o||ddd |dÉVqt|d|dÉVndS(Nis ../ver_majorttagitTagRRRtR>t tag_altersTag alter preservationt file_altertrd_onlys Read only?s padding[]it compressedsFrame is compressed?t encryptedsFrame is encrypted?tgroupsGrouping identityiiitTRHRIsRaw data content(R"RRR]t tag23_nametID3_SizeRR R t tag22_nameRR?tFalsetNonethandlerR2R (R%R>t is_compressedtclsRÇ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'Ös<, , cCs,|didjod|diSdSdS(NR>is ID3 Chunk: %sRÇsID3 Chunk: (terminator)(R"tdisplay(R%((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR.≠s(R/R0RtendianRéRåR@RPRZRFRER8RëRÄR'R.(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR]TsP     (RçcBs#eZdZddÑZdÑZRS(i cCsti|||d|ÉdS(Ni (R RÄ(R%tparenttnameR\((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRÄ∂scCs5|iii|idÉ}tdÑdÑ|DÉÉS(NicSs |d|S(iÄ((txty((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyt<lambda>ºscssx|]}t|ÉVqWdS(N(tord(t.0titem((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pys <genexpr>ºs (RñR*R+R)treduce(R%tdata((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyt createValueπsN(R/R0R1RêRÄR†(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRç≥s tID3v2cBs2eZeZdZddÑZdÑZdÑZRS(iiicCsCti|||d|É|ip|didd|_ndS(NR>i i(RRÄR;R"(R%RñRóR>((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyRĬs cCsd|di|difS(Ns ID3 v2.%s.%st ver_majort ver_minor(R"(R%((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR.«sccsst|dddddÉVt|ddÉVt|dd ÉV|did jotd ÉÇn|di|ijp|did jo(td |di|difÉÇnt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|dÉVxE|i|i jo1t |dÉ}|V|did joPqqW|i |i É}|o |VndS(Ntheaderis Header (ID3)RRR¢sVersion (major)R£sVersion (minor)tID3s!Signature error, should be "ID3".is&Unknown ID3 metadata version (2.%u.%u)tunsyncsUnsynchronisation is used?textsExtended header is used?texpsExperimental indicators padding[]iR>sfield[]( RRR"RtVALID_MAJOR_VERSIONSR R RçR?R;R]tseekBit(R%R5tpadding((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR'Às0" (iiiN( R/R0RRïR©RêRÄR.R'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyR°æs   N(#t__doc__thachoir_core.fieldRRRRRRRRRR R R R R thachoir_core.text_handlerRthachoir_core.toolsRthachoir_core.endianRRR7R8R2R@RERFRJRPRZR]RçR°(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/id3.pyt<module>s"^∆     " _
18,993
Python
.py
83
227.795181
1,402
0.451954
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,603
modplug.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/modplug.pyc
—Ú Œ »Mc@s˘dZddklZlZlZlZlZlZlZl Z l Z l Z ddk l Z ddklZlZdZdÑZdefdÑÉYZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZdÑZdÑZdÑZdefdÑÉYZdefdÑÉYZdefdÑÉYZdÑZhh0eddfd6eddfd6eddfd6edd fd!6edd"fd#6edd$fd%6edd&fd'6edd(fd)6edd*fd+6edd,fd-6edd.fd/6edd0fd16edd2fd36edd4fd56edd6fd76edd8fd96edd:fd;6edd<fd=6edd>fd?6edd@fdA6eddBfdC6eddDfdE6eddFfdG6eddHfdI6eddJfdK6eddLfdM6eddNfdO6eddPfdQ6eddRfdS6eddTfdU6eddVfdW6eddXfdY6eedZfd[6eed\fd]6eed^fd_6eed`fda6eedbfdc6eeddfde6edfdgfdh6edfdifdj6e ddkfdl6e dmdnfdo6eddpfdq6eddrfds6eddtfdu6eddvfdw6eddxfdy6eddzfd{6d|6h edd}fd~6d†dÅ6d°dÉ6d¢dÖ6d£dá6d§dâ6d•dã6d¶dç6dßdè6d®dë6d©dì6d™dï6d´dó6dò6ZdôefdöÑÉYZ dõÑZ!dúefdùÑÉYZ"dûÑZ#düS(¨s÷ Modplug metadata inserted into module files. Doc: - http://modplug.svn.sourceforge.net/viewvc/modplug/trunk/modplug/soundlib/ Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 10th February 2007 iˇˇˇˇ( tFieldSettUInt32tUInt16tUInt8tInt8tFloat32tRawBytestStringt GenericVectort ParserError(t LITTLE_ENDIAN(t textHandlert hexadecimali ccs3|di}|djot|d|ÉVndS(Nt block_sizeitcomment(tvalueR(tparsertsize((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt parseCommentss  tMidiOutcBseZdZdÑZRS(i i ic cs,x%d D]}t||d d d ÉVqWdS(Ntstarttstoptticktnoteontnoteofftvolumetpantbankseltprogrami tstript( sstartsstopRRRsvolumeRRsprogram(R(tselftname((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt createFieldssi i (t__name__t __module__t static_sizeR!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRstCommandcBseZdZdÑZRS(i iccsâ|i}|iidt|É}|djo;|id|ii||ÉÉt|d|ddÉVnt|d|id|ÉVdS(NRis Command: %stcommandRt parameteri( tabsolute_addresststreamtsearchBytesLengthtFalsetinfot readBytesRRt_size(RRR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!!s    i(R"R#R$R!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR%st MidiSFXExtcBseZdZdÑZRS(ii iccs)x"tdÉD]}t|dÉVq WdS(Nis command[](txrangeR%(Rtindex((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!+s ii(R"R#R$R!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR/)st MidiZXXExtcBseZdZdÑZRS(iÄi iccs)x"tdÉD]}t|dÉVq WdS(NiÄs command[](R0R%(RR1((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!1s iiÄ(R"R#R$R!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR2/sccs.t|dÉVt|dÉVt|dÉVdS(Ntmidi_outtsfx_exttzxx_ext(RR/R2(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pytparseMidiConfig5sccs=|did}|djot|d|tdÉVndS(NR iitsettingst mix_plugin(RRR(RR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pytparseChannelSettings:s ccs=|did}|djot|d|tdÉVndS(NR iitgainstband(RRR(RR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt parseEQBands?s tSoundMixPluginInfocBseZdZdÑZRS(iÄiccsôtt|dÉtÉVtt|dÉtÉVt|dÉVt|dÉVt|ddtdÉVt|dd d d ÉVt|d d ddd d ÉVdS(Nt plugin_id1t plugin_id2t input_routingtoutput_routingt routing_infoitreservedR i RRtdll_namei@tdescsOriginal DLL name(R RR RR(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!Fsi(R"R#R$R!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR=Dst ExtraDatacBseZddÑZdÑZRS(cCs2ti||||Éd|did|_dS(NiRi(Rt__init__RR.(RtparentR RE((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRGPsccs;t|dÉV|di}|ot|d|ÉVndS(NRtdata(RRR(RR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!Ts N(R"R#tNoneRGR!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRFOs t XPlugDatacBseZddÑZdÑZRS(cCs2ti||||Éd|did|_dS(NiRi(RRGRR.(RRHR RE((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRG[sccs~t|dÉVxi|ip^t|dÉV|didjot|dÉVq|didjot|dÉVqqWdS(NRtmarkertDWRTt dry_ratiotPORGtdefault_program(RteofRR(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!_s N(R"R#RJRGR!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRKZs ccs t|dÉV|ii|i|idtÉ}d|jo|i|ijnot|dÉVn|ii|i|idtÉ}d|jo|i|ijnot|dÉVndS(NR,i it extra_datat xplug_data( R=R)treadBitsR(t current_sizeR R.RFRK(RR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt parsePluginhs"("(itFlagss..FdsFade outs..OFs Global Volumes..VGtPannings...PsVolume Envelopes..EVsPanning Envelopes..EPsPitch Envelopes.EiPsVolume Loop Starts.SLVsVolume Loop Ends.ELVsVolume Sustain Begins.BSVsVolume Sustain Ends.ESVsPanning Loop Starts.SLPsPanning Loop Ends.ELPsPanning Substain Begins.BSPsPadding Substain Ends.ESPsPitch Loop StarttSLiPsPitch Loop EndtELiPsPitch Substain BegintBSiPsPitch Substain EndtESiPtNNAs.ANNtDCTs.TCDtDNAs.ANDs Panning Swings..SPs Volume Swings..SVtIFCs.CFItIFRs.RFIs Midi Banks..BMs Midi Programs..PMs Midi Channels..CMs Midi Drum Keys.KDMtPPSs.SPPtPPCs.CPPs Volume Pointss.[PVsPanning Pointss.[PPs Pitch Pointss[PiPsVolume Enveloppes.[EVsPanning Enveloppes.[EPsPitch Enveloppes[EiPiÄs Note Mappings.[MNtKeyboards..[KtNames..[ni tFilenames.[nftMixPlugs.PiMsVolume Rampings..RVt Resamplings...Rs Cut Swings..SCs Res Swings..SRs Filter Modes..MFtXTPMtChannelss...CisCreatedWith versions.VWCsDefault global volumes.VGDs Default tempos..TDsEmbedded instrument headertHIBEsLastSavedWith versiontVWSLsPlugin Mix modes.MMPs Rows per beats.BPRsRows per measures.MPRsChunk separators@PESsSong Pre-amplifications.APSs Tempo modes..MTs VSTi volumetVTSVtSTPMtMPFieldcBs&eZddÑZdÑZdÑZRS(cCsNti||||É||_|i|iÉÉd|did|_dS(Nit data_sizei(RRGtextR,tcreateDescriptionRR.(RRHR RqRE((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRGæs ccs|ii|idÉ}||ijo|i|\}}}ntdd}}}t|dd|ÉVt|dÉV|p3|di}|djot|d|ÉVqn_|ttfjo||d|ÉVn7|djot|d ||d ÉVn||dÉVdS( Niis Unknown tagtcodeRpiRIRtvaluestitem( R)R-R(RqRRRRR(RRstclstcountRR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR!ƒs   cCsd|di|difS(NsElement '%s', size %iRsRp(t _descriptionR(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRr›sN(R"R#RJRGR!Rr(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRoΩs  ccsÕt|di}|djotd|diÉÇn|i|i}xP|i oD|ii|dÉ|jo(t |d|É}|V||i 7}qLW|i d|di|ii|dÉfÉdS(Nt block_typesUnknown parent '%s'isfield[]s'End of extension '%s' when finding '%s'( t EXTENSIONSRRJR R(RURQR)R-RoR.R,(RRqtaddrtfield((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt parseFields·s ' t ModplugBlockcBsÇeZhdedefd6dedefd6dedefd6d ed efd 6d ed efd6ZddÑZ dÑZ RS(RtCommenttTEXTt midi_configsMidi configurationtMIDItchannel_settingssChannel settingstXFHCtinstrument_extsInstrument extensionsRitsong_extsSong extensionsRncsÿtià||àÉtà_àdi}tà_|àijoiài|\à_à_âât àÉoááfdÜà_ nàoááfdÜà_qÆnàiodàdidà_ ndS(NRycs ààÉS((((RRE(sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt<lambda>scs ààÉS((((t parseBlockR(sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRásiR ( RRGRVRàRR+thas_sizet BLOCK_INFOt_nametcallableRrR.(RRHR REtt((RRàREsF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyRG˙s     ccs¶t|ddÉV|iot|dÉVn|io x|iÉD] }|VqDWn|ioA|di|id}|djot|d|dÉVq¢ndS(NRyiR iiRIs Unknown data(RRâRRàRRUR(RR|R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR! s      N( R"R#tTrueRR6R9R+R}RäRJRGR!(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyR~Ús ccsÄx<|ip1t|dÉ}|V|didjoPqqW|i|i|id}|djot|d|ÉVndS(Nsblock[]RyRniiR,(RQR~RR.R(RUR(RtblockR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pytParseModplugMetadatas   N(NisCreatedWith version(NisDefault global volume(Nis Default tempo(NisEmbedded instrument header(NisLastSavedWith version(NisPlugin Mix mode(Nis Rows per beat(NisRows per measure(NisChunk separator(NisSong Pre-amplification(Nis Tempo mode(Nis VSTi volume($t__doc__thachoir_core.fieldRRRRRRRRRR thachoir_core.endianR thachoir_core.text_handlerR R t MAX_ENVPOINTSRRR%R/R2R6R9R<R=RFRKRVRJRzRoR}R~Rê(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/audio/modplug.pyt<module> s®F        $ &
14,639
Python
.py
49
297.714286
1,842
0.456645
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,604
aiff.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/aiff.pyc
—Ú Œ »Mc @sHdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z ddklZddklZddklZddklZhdd 6d d 6d d 6dd6dd6dd6ZdefdÑÉYZdÑZdÑZdÑZdÑZdÑZdÑZdefdÑÉYZdefdÑÉYZd S(!sa Audio Interchange File Format (AIFF) parser. Author: Victor Stinner Creation: 27 december 2006 iˇˇˇˇ(tParser( tFieldSettUInt16tUInt32tFloat80tTimestampMac32tRawBytest NullBytestStringtEnumtPascalString32(t BIG_ENDIAN(tfilesizeHandler(t alignValue(tID3v2u ACE 2-to-1tACE2u ACE 8-to-3tACE8u MAC 3-to-1tMAC3u MAC 6-to-1tMAC6uNonetNONEuLittle-endian, no compressiontsowttCommentcBseZdÑZRS(ccs t|dÉVt|dÉVdS(Nt timestampttext(RR (tself((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt createFieldss(t__name__t __module__R(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyRsccst|d|diÉVdS(NRtsize(Rtvalue(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt parseText sccs#t|dd|didÉVdS(Ntid3v2Ri(RR(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pytparseID3#sccs>t|dÉVx)t|diÉD]}t|dÉVq"WdS(Nt nb_comments comment[](RtxrangeRR(Rtindex((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt parseComment&sc csbt|dÉVt|dÉVt|dÉVt|dÉVtt|ddddd d ÉtÉVdS( Nt nb_channelt nb_samplet sample_sizet sample_ratetcodecitstripttcharsettASCII(RRRR Rt CODEC_NAME(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt parseCommon+s ccst|dÉVdS(NR(R(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt parseVersion2sccsPt|dÉVt|dÉV|i|id}|ot|d|ÉVndS(Ntoffsett block_sizeitdata(RRt current_sizeR(RR((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt parseSound5s tChunkcBsêeZhddefd6ddefd6ddefd6d d efd 6d d efd6ddefd6ddefd6ZdÑZ dÑZ RS(tcommons Common chunktCOMMtcommentRtCOMTtnametNametNAMEtauthortAuthortAUTHtversiontVersiontFVERtsounds Sound datatSSNDtid3tID3sID3 cGs~ti||ådt|didÉd|_|di}||ijo#|i|\|_|_|_n d|_dS(NiRittype( Rt__init__R Rt_sizetTAG_INFOt_namet _descriptiont_parsertNone(Rtargsttag((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyRIGs ! #ccs®t|dddddÉVtt|dÉÉV|di}|ob|ioCx|i|ÉD] }|Vq\W|dot|dd ÉVq†q§t|d |ÉVndS( NRHisSignature (FORM)R,R-RitpaddingiR3(RR RRRNRR(RRtfield((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyRPs    ( RRR/R$RR0R5R RKRIR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyR6<s tAiffFilecBsieZhdd6dd6dd6dd6dd 6dd6dd6ZeZdÑZdÑZdÑZdÑZRS(taifftidtaudiotcategorytaiftaifctfile_extu audio/x-aifftmimesFORM.{4}AIF[CF]it magic_regexi itmin_sizes$Audio Interchange File Format (AIFF)t descriptioncCsF|iiddÉdjodS|iid dÉd jodStS( NiitFORMsInvalid signatureitAIFFtAIFCs Invalid typei@(RaRb(tstreamt readBytestTrue(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pytvalidateis ccslt|dddddÉVtt|dÉÉVt|dddddÉVx|ipt|d ÉVqKWdS( Nt signatureisSignature (FORM)R,R-tfilesizeRHsForm type (AIFF or AIFC)schunk[](RR RteofR6(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyRps  cCs!|didjodSdSdS(NRHRbs/Audio Interchange File Format Compressed (AIFC)s$Audio Interchange File Format (AIFF)(R(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pytcreateDescriptionwscCs|didS(NRhi(R(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pytcreateContentSize}s(RYRURZ(u audio/x-aiff(sFORM.{4}AIF[CF]i((sFORM.{4}AIF[CF]ii`( RRt PARSER_TAGSR tendianRfRRjRk(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyRT]s    N( t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R thachoir_core.endianR thachoir_core.text_handlerR thachoir_core.toolsR thachoir_parser.audio.id3RR.RRR R$R/R0R5R6RT(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/aiff.pyt<module>s,F       !
6,701
Python
.py
40
166.5
788
0.467197
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,605
mpeg_audio.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/mpeg_audio.pyc
—Ú Œ »Mc @s&dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z ddklZlZddklZddklZlZddklZddklZdd klZdZd efdÑÉYZdÑZdefdÑÉYZdÑZ defdÑÉYZ!dS(sL MPEG audio file parser. Creation: 12 decembre 2005 Author: Victor Stinner iˇˇˇˇ(tParser( tFieldSett MissingFieldt ParserErrortcreateOrphanFieldtBittBitstEnumt PaddingBitst PaddingBytestRawBytes(tID3v1tID3v2(t BIG_ENDIAN(thumanFrequencyt humanBitSize(tlong2raw(tHACHOIR_ERRORS(tInputStreamErrori»iitFramecBsâeZhdd6dd6dd6ZdZdZdZhdd6dd6d d6ZdZdZdZ hd:d;d<fd6d=d>d?fd6Z hhd"d6d#d6d$d6d6hd%d6d&d6d'd6d6hd(d6d)d6d*d6d6Z hd+d6d,d6d-d6Z hd.d6d/d6d0d6d1d6Z hdd6dd6dd6dd6Zd2ÑZd3ÑZd4ÑZd5ÑZd6ÑZd7ÑZd8ÑZd9ÑZRS(@s2.5it2it1itIIIitIItIi i@i`iÄi†i¿i‡ii i@i`iÄi†i¿i0i8iPipi(iêi∞iiiiD¨iĪi}i"Vi¿]iÄ>i+i‡.i@tnones50/15 mss CCIT J.17tStereos Joint stereos Dual channelsSingle channelcOsrti|||é|ipQ|iÉ}|ptd|iÉÇnt|d|ii|i É|_ndS(NsMPEG audio: Invalid frame %si( Rt__init__t_sizet getFrameSizeRtpathtmintparenttsizetaddress(tselftargstkwt frame_size((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRGs   ccs_t|dddddÉVtt|dddÉ|iÉVtt|d dd É|iÉVt|d d ÉVt|d ddÉVt|dddÉVt|ddÉVt|ddÉVtt|dddÉ|iÉVt|dddÉVt|ddÉVt|ddÉVtt|dddÉ|iÉV|i|i d }|ot |d!|ÉVndS("Ntsynci sSynchronize bits (set to 1)tpatternitversionisMPEG audio versiontlayersMPEG audio layertcrc16sNo CRC16 protection?tbit_rateisBit ratet sampling_rates Sampling ratet use_paddingsStream field use padding?t extensiont Extensiont channel_modes Channel modetmode_extsMode extensiont copyrightsIs copyrighted?toriginals Is original?temphasistEmphasisitdata( RRRt VERSION_NAMEt LAYER_NAMERtCHANNEL_MODE_NAMEt EMPHASIS_NAMER!t current_sizeR (R#R!((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyt createFieldsOs     cCsu|didjoa|didjoM|didjo9|didjo%|d id jo|d id jS(NR*iR'iˇR)iR-iR,iR5i(ii(tvalue(R#((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytisValidgs cCsN|di}|di}y|i||SWnttfj odSXdS(s< Read sampling rate. Returns None on error. R)R-N(R>tSAMPLING_RATEStKeyErrort IndexErrortNone(R#R)trate((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyt getSampleRateos   cCsód|di}|di}|d jod S|didjo|id}n|id}y|||d SWnttfj od SXd S( sB Read bit rate in bit/sec. Returns None on error. iR*R,iiR)iiiËN(ii(R>RCt BIT_RATESRARB(R#R*R,tdataset((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyt getBitRatezs   cCs‹|iÉ}|pdS|iÉ}|pdSt|diÉ}|di|ijo<|di|ijo|d||S|d||SnC|di|ijo|d||S|d|}||dSdS( sB Read frame size in bytes. Returns None on error. R.R*R)iêiHi iN(RHRCREtintR>t LAYER_IIItMPEG_ItLAYER_II(R#R&t sample_ratetpadding((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRãs  cCs|i|diS(NR1(t NB_CHANNELR>(R#((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyt getNbChannel¢scCsäd|dig}|iÉ}|o|idt|ÉÉn|iÉ}|o|it|ÉÉnd|didi|ÉfS(Nslayer %sR*s%s/secs MPEG-%s %sR)s, (tdisplayRHtappendRRERtjoin(R#tinfoR,R-((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytcreateDescription•s  (ii i@i`iÄi†i¿i‡ii i@i`iÄi†i¿(ii i0i8i@iPi`ipiÄi†i¿i‡ii@iÄ(ii i(i0i8i@iPi`ipiÄi†i¿i‡ii@(ii i0i8i@iPi`ipiÄiêi†i∞i¿i‡i(iiiii i(i0i8i@iPi`ipiÄiêi†(iiiii i(i0i8i@iPi`ipiÄiêi†(t__name__t __module__R8RKtMPEG_IIt MPEG_II_5R9tLAYER_IRLRJRFR@R;R:RORR=R?RERHRRPRU(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRsL          c Cs‹|i}||}d}xº||joÆ|iidt||É}|djodS||7}||d7}y)t|||tdÉ}|iÉ}Wntj o t}nX|o|S|d7}|d7}qWdS(sÅ Find synchronisation bits (11 bits set to 1) Returns None on error, or number of bytes before the synchronization. isˇitframeiN( tabsolute_addresststreamtsearchBytesLengthtFalseRCRRR?R( tparsertstarttmax_sizetaddress0tendR!tlengthR[tvalid((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytfindSynchronizeBitsØs(       tFramescBs5eZdZdÑZddÑZdÑZdÑZRS(icCsâ|i}||i}t||id||iÉ}t|||É}|djotdÉÇn|ot|d|dÉSdSdS(Nis/MPEG audio: Unable to find synchronization bitss padding[]sPadding before synchronization( R\R<Rt MAX_PADDINGR!RgRCRR (R#taddrRaRdRN((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyt synchronize”s  ! i cCsäd}d}xwt|idÉÉD]`\}}|o5x2|D]&}||i||ijotSq<Wn|}||joPq"q"WtS(s‘ Guess if frames are constant bit rate. If it returns False, you can be sure that frames are variable bit rate. Otherwise, it looks like constant bit rate (on first count fields). R)R*R,R[(sversionslayersbit_rateN(RCt enumeratetarrayR>R_tTrue(R#tcountt check_keyst last_fieldtindextfieldtkey((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytlooksConstantBitRatefls    ccsy|iÉ}|o |Vnx&|i|ijot|dÉVqW|i|id}|ot|d|ÉVndS(Nsframe[]itraw(RkR<R!RR (R#RNR!((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyR=Òs  cCs%|iÉo d}nd}d|S(Ns$(looks like) Constant bit rate (CBR)sVariable bit rate (VBR)s Frames: %s(Ru(R#ttext((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRUs  (RVRWRiRkRuR=RU(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRhœs   c CsÃd g}x.tiD]#}d|}|i|dfÉqWd}xÖtiiÉD]t}xktiiÉD]Z}xQd D]I}|d>|d>B|d>B|B}t|tdÉ}|i|dfÉqsWqfWqPW|S( NtTAGisID3%ciˇiiii(sTAGi(ii( R tVALID_MAJOR_VERSIONSRRRR8titerkeysR9RR (tmagicst ver_majortmagict SYNC_BITSR)R*R+((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytcreateMpegAudioMagic s    t MpegAudioFilecBsieZhdd6dd6dd6dd 6dd 6dd6dd6ZeZdÑZdÑZdÑZdÑZRS(t mpeg_audiotidtaudiotcategorytmpatmp1tmp2tmp3tfile_extu audio/mpegtmimeiitmin_sizesMPEG audio version 1, 2, 2.5t descriptiontskiptsubfilecCs˚|did jotS|iiptSx…tdÉD]ª}y|d|}WnUtj o,d|jo|diotSd|Stt fj o d |SX|i Ép d |S|p |}q8|d i |d i jo d |Sq8WtS(Nitid3v2tid3v1isframes/frame[%u]itframessUnable to get frame #%usUnable to create frame #%usFrame #%u is invalidR1s#Frame #%u channel mode is different(sid3v2Rê( tnameRnR]tcheckedR_txrangeRtdoneRRR?R>(R#RrR[tframe0((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytvalidate+s,         ccsË|iiddÉdjot|dÉVn|idjo tÇn|i|i}|id }d|jo4|ii|dÉdj}|o|d 8}q¨nt}|ot |dd |ÉVn|ot |d ÉVndS( NiitID3RèiÄiRxRëR!Rêii( R]t readBytesR RRCtNotImplementedErrorR!R<R_RhR (R#t frames_sizeRjthas_id3((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyR=Ks   cCsjd|jo#|d}d|i|difSd|jo |diSd|jo |diSdSdS(NRësframes/frame[0]s%s, %sR1RèRês MPEG audio(RåRQ(R#R[((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRUes      c CsI|d}|idjoAy|d}Wntj o |iSX|idjodSn|}|d}|i}||i}xxtopy/t|||tdÉ}|iÉpPnWnt j oPnXt ||ijoPn||i7}qÑWy1|i i |dÉdjo|t i7}nWntj o }nX|S(NiRëisframe[0]R[iRx(RíRR!RCR\RnRRR?Rt MAX_FILESIZER]RôR t static_sizeR(R#RsRëR[RcR!terr((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pytcreateContentSizeps:        (RÖRÜRáRà(u audio/mpegi ( RVRWt PARSER_TAGSR tendianRóR=RUR†(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyRÄs   Ni iÄ id("t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R thachoir_parser.audio.id3R R thachoir_core.endianR thachoir_core.toolsRRthachoir_core.bitsRthachoir_core.errorRthachoir_core.streamRRùRRgRhRRÄ(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/mpeg_audio.pyt<module>sFó : 
13,442
Python
.py
84
157.904762
772
0.42794
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,606
flac.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/flac.py
""" FLAC (audio) parser Documentation: * http://flac.sourceforge.net/format.html Author: Esteban Loiseau <baal AT tuxfamily.org> Creation date: 2008-04-09 """ from hachoir_parser import Parser from hachoir_core.field import FieldSet, String, Bit, Bits, UInt16, UInt24, RawBytes, Enum, NullBytes from hachoir_core.stream import BIG_ENDIAN, LITTLE_ENDIAN from hachoir_core.tools import createDict from hachoir_parser.container.ogg import parseVorbisComment class VorbisComment(FieldSet): endian = LITTLE_ENDIAN createFields = parseVorbisComment class StreamInfo(FieldSet): static_size = 34*8 def createFields(self): yield UInt16(self, "min_block_size", "The minimum block size (in samples) used in the stream") yield UInt16(self, "max_block_size", "The maximum block size (in samples) used in the stream") yield UInt24(self, "min_frame_size", "The minimum frame size (in bytes) used in the stream") yield UInt24(self, "max_frame_size", "The maximum frame size (in bytes) used in the stream") yield Bits(self, "sample_hertz", 20, "Sample rate in Hertz") yield Bits(self, "nb_channel", 3, "Number of channels minus one") yield Bits(self, "bits_per_sample", 5, "Bits per sample minus one") yield Bits(self, "total_samples", 36, "Total samples in stream") yield RawBytes(self, "md5sum", 16, "MD5 signature of the unencoded audio data") class SeekPoint(FieldSet): def createFields(self): yield Bits(self, "sample_number", 64, "Sample number") yield Bits(self, "offset", 64, "Offset in bytes") yield Bits(self, "nb_sample", 16) class SeekTable(FieldSet): def createFields(self): while not self.eof: yield SeekPoint(self, "point[]") class MetadataBlock(FieldSet): "Metadata block field: http://flac.sourceforge.net/format.html#metadata_block" BLOCK_TYPES = { 0: ("stream_info", u"Stream info", StreamInfo), 1: ("padding[]", u"Padding", None), 2: ("application[]", u"Application", None), 3: ("seek_table", u"Seek table", SeekTable), 4: ("comment", u"Vorbis comment", VorbisComment), 5: ("cue_sheet[]", u"Cue sheet", None), 6: ("picture[]", u"Picture", None), } BLOCK_TYPE_DESC = createDict(BLOCK_TYPES, 1) def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = 32 + self["metadata_length"].value * 8 try: key = self["block_type"].value self._name, self._description, self.handler = self.BLOCK_TYPES[key] except KeyError: self.handler = None def createFields(self): yield Bit(self, "last_metadata_block", "True if this is the last metadata block") yield Enum(Bits(self, "block_type", 7, "Metadata block header type"), self.BLOCK_TYPE_DESC) yield UInt24(self, "metadata_length", "Length of following metadata in bytes (doesn't include this header)") block_type = self["block_type"].value size = self["metadata_length"].value if not size: return try: handler = self.BLOCK_TYPES[block_type][2] except KeyError: handler = None if handler: yield handler(self, "content", size=size*8) elif self["block_type"].value == 1: yield NullBytes(self, "padding", size) else: yield RawBytes(self, "rawdata", size) class Metadata(FieldSet): def createFields(self): while not self.eof: field = MetadataBlock(self,"metadata_block[]") yield field if field["last_metadata_block"].value: break class Frame(FieldSet): SAMPLE_RATES = { 0: "get from STREAMINFO metadata block", 1: "88.2kHz", 2: "176.4kHz", 3: "192kHz", 4: "8kHz", 5: "16kHz", 6: "22.05kHz", 7: "24kHz", 8: "32kHz", 9: "44.1kHz", 10: "48kHz", 11: "96kHz", 12: "get 8 bit sample rate (in kHz) from end of header", 13: "get 16 bit sample rate (in Hz) from end of header", 14: "get 16 bit sample rate (in tens of Hz) from end of header", } def createFields(self): yield Bits(self, "sync", 14, "Sync code: 11111111111110") yield Bit(self, "reserved[]") yield Bit(self, "blocking_strategy") yield Bits(self, "block_size", 4) yield Enum(Bits(self, "sample_rate", 4), self.SAMPLE_RATES) yield Bits(self, "channel_assign", 4) yield Bits(self, "sample_size", 3) yield Bit(self, "reserved[]") # FIXME: Finish frame header parser class Frames(FieldSet): def createFields(self): while not self.eof: yield Frame(self, "frame[]") # FIXME: Parse all frames return class FlacParser(Parser): "Parse FLAC audio files: FLAC is a lossless audio codec" MAGIC = "fLaC\x00" PARSER_TAGS = { "id": "flac", "category": "audio", "file_ext": ("flac",), "mime": (u"audio/x-flac",), "magic": ((MAGIC, 0),), "min_size": 4*8, "description": "FLAC audio", } endian = BIG_ENDIAN def validate(self): if self.stream.readBytes(0, len(self.MAGIC)) != self.MAGIC: return u"Invalid magic string" return True def createFields(self): yield String(self, "signature", 4,charset="ASCII", description="FLAC signature: fLaC string") yield Metadata(self,"metadata") yield Frames(self,"frames")
5,626
Python
.py
136
33.588235
116
0.619309
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,607
real_audio.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/real_audio.pyc
Ñò Î ÈMc@s°dZddklZddklZlZlZlZlZl Z l Z l Z ddk l Z ddklZddklZdefd„ƒYZd efd „ƒYZd S( s¡ RealAudio (.ra) parser Author: Mike Melanson References: http://wiki.multimedia.cx/index.php?title=RealMedia Samples: http://samples.mplayerhq.hu/real/RA/ iÿÿÿÿ(tParser(tFieldSettUInt8tUInt16tUInt32tBytestRawBytestStringt PascalString8(thumanFrequency(tdisplayHandler(t BIG_ENDIANtMetadatacBseZd„ZRS(ccsTt|dddƒVt|dddƒVt|dddƒVt|dddƒVdS(Nttitletcharsets ISO-8859-1tauthort copyrighttcomment(R(tself((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pyt createFieldss(t__name__t __module__R(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pyR st RealAudioFilecBsreZdZhdd6dd6dgd6dd 6dd 6ed ffd6dd6ZeZd„Zd„Zd„ZRS(s.raýt real_audiotidtaudiotcategorytratfile_extuaudio/x-realaudiouaudio/x-pn-realaudiotmimeiitmin_sizeitmagicuReal audio (.ra)t descriptioncCs9|di|ijodS|didjodStS(Nt signaturesInvalid signaturetversioniisUnknown version(ii(tvaluetMAGICtTrue(R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pytvalidate(s ccsDt|dddƒVt|ddƒV|didjont|ddƒVt|d d ƒVt|d d ƒVt|d ƒVt|dƒVt|dƒV|d i}nxt|ddƒVt|dddƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d!ƒVt|d"d#ƒVt|d$d%ƒVt|d&d'ƒVt t|d(d)ƒt ƒVt|d*d'ƒVt|d+d,ƒVt|d-d.ƒVt|d/ƒVt|dƒVt|d0dƒVt|d ƒV|did1|did2}d3|jot|d4|ƒVndS(5NR!is RealAudio identifier ('.ra\xFD')R"tVersionit header_sizes Header sizetUnknown1i t data_sizes Data sizetmetadatatUnknown2tFourCCt reserved1sReserved, should be 0tra4sigs'.ra4' signaturetfilesizesFile size (minus 40 bytes)tversion2s#Version 2 (always equal to version)t headersizesHeader size (minus 16)t codec_flavors Codec flavortcoded_frame_sizesCoded frame sizetunknown1i t subpackethsSubpacket h (?)t frame_sizes Frame sizetsub_packet_sizesSubpacket sizetunknown2tUnknownt sample_rates Sample ratetunknown3t sample_sizes Sample sizetchannelstChannelssInterleaving ID Stringtunknown4i(iit audio_data( RRR#RRR RRRR R (Rt audio_size((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pyR/sB  cCsg|didjod|diS|didjo'd|di|di|difSd SdS( NR"isRealAudio v3 file, '%s' codecR-is.RealAudio v4 file, '%s' codec, %s, %u channelsR;R>s Real audio(R#tdisplay(R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pytcreateDescriptionSs $(uaudio/x-realaudiouaudio/x-pn-realaudioi0( RRR$t PARSER_TAGSR tendianR&RRD(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pyRs    $N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRthachoir_core.toolsR thachoir_core.text_handlerR thachoir_core.endianR R R(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/audio/real_audio.pyt<module> s:
4,479
Python
.py
32
138.8125
522
0.497189
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,608
__init__.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/__init__.pyc
Ñò Î ÈMc @s´ddklZddklZddklZddklZddkl Z ddk l Z ddk l Z ddklZdd klZdd klZdd klZd S( iÿÿÿÿ(tAiffFile(tAuFile(t ITunesDBFile(tMidiFile(t MpegAudioFile(t RealAudioFile(tXMModule(t S3MModule(t PTMModule(t AmigaModule(t FlacParserN(thachoir_parser.audio.aiffRthachoir_parser.audio.auRthachoir_parser.audio.itunesdbRthachoir_parser.audio.midiRthachoir_parser.audio.mpeg_audioRthachoir_parser.audio.real_audioRthachoir_parser.audio.xmRthachoir_parser.audio.s3mRRthachoir_parser.audio.modR thachoir_parser.audio.flacR (((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/__init__.pyt<module>s
941
Python
.py
6
155.833333
380
0.53953
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,609
real_audio.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/real_audio.py
""" RealAudio (.ra) parser Author: Mike Melanson References: http://wiki.multimedia.cx/index.php?title=RealMedia Samples: http://samples.mplayerhq.hu/real/RA/ """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt8, UInt16, UInt32, Bytes, RawBytes, String, PascalString8) from hachoir_core.tools import humanFrequency from hachoir_core.text_handler import displayHandler from hachoir_core.endian import BIG_ENDIAN class Metadata(FieldSet): def createFields(self): yield PascalString8(self, "title", charset="ISO-8859-1") yield PascalString8(self, "author", charset="ISO-8859-1") yield PascalString8(self, "copyright", charset="ISO-8859-1") yield PascalString8(self, "comment", charset="ISO-8859-1") class RealAudioFile(Parser): MAGIC = ".ra\xFD" PARSER_TAGS = { "id": "real_audio", "category": "audio", "file_ext": ["ra"], "mime": (u"audio/x-realaudio", u"audio/x-pn-realaudio"), "min_size": 6*8, "magic": ((MAGIC, 0),), "description": u"Real audio (.ra)", } endian = BIG_ENDIAN def validate(self): if self["signature"].value != self.MAGIC: return "Invalid signature" if self["version"].value not in (3, 4): return "Unknown version" return True def createFields(self): yield Bytes(self, "signature", 4, r"RealAudio identifier ('.ra\xFD')") yield UInt16(self, "version", "Version") if self["version"].value == 3: yield UInt16(self, "header_size", "Header size") yield RawBytes(self, "Unknown1", 10) yield UInt32(self, "data_size", "Data size") yield Metadata(self, "metadata") yield UInt8(self, "Unknown2") yield PascalString8(self, "FourCC") audio_size = self["data_size"].value else: # version = 4 yield UInt16(self, "reserved1", "Reserved, should be 0") yield String(self, "ra4sig", 4, "'.ra4' signature") yield UInt32(self, "filesize", "File size (minus 40 bytes)") yield UInt16(self, "version2", "Version 2 (always equal to version)") yield UInt32(self, "headersize", "Header size (minus 16)") yield UInt16(self, "codec_flavor", "Codec flavor") yield UInt32(self, "coded_frame_size", "Coded frame size") yield RawBytes(self, "unknown1", 12) yield UInt16(self, "subpacketh", "Subpacket h (?)") yield UInt16(self, "frame_size", "Frame size") yield UInt16(self, "sub_packet_size", "Subpacket size") yield UInt16(self, "unknown2", "Unknown") yield displayHandler(UInt16(self, "sample_rate", "Sample rate"), humanFrequency) yield UInt16(self, "unknown3", "Unknown") yield UInt16(self, "sample_size", "Sample size") yield UInt16(self, "channels", "Channels") yield PascalString8(self, "Interleaving ID String") yield PascalString8(self, "FourCC") yield RawBytes(self, "unknown4", 3) yield Metadata(self, "metadata") audio_size = (self["filesize"].value + 40) - (self["headersize"].value + 16) if 0 < audio_size: yield RawBytes(self, "audio_data", audio_size) def createDescription(self): if (self["version"].value == 3): return "RealAudio v3 file, '%s' codec" % self["FourCC"].value elif (self["version"].value == 4): return "RealAudio v4 file, '%s' codec, %s, %u channels" % ( self["FourCC"].value, self["sample_rate"].display, self["channels"].value) else: return "Real audio"
3,762
Python
.py
83
36.433735
92
0.60866
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,610
s3m.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/s3m.py
""" The ScreamTracker 3.0x module format description for .s3m files. Documents: - Search s3m on Wotsit http://www.wotsit.org/ Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 11th February 2007 """ from hachoir_parser import Parser from hachoir_core.field import (StaticFieldSet, FieldSet, Field, Bit, Bits, UInt32, UInt16, UInt8, Enum, PaddingBytes, RawBytes, NullBytes, String, GenericVector, ParserError) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.tools import alignValue class Chunk: def __init__(self, cls, name, offset, size, *args): # Todo: swap and have None=unknown instead of now: 0=unknown assert size != None and size>=0 self.cls = cls self.name = name self.offset = offset self.size = size self.args = args class ChunkIndexer: def __init__(self): self.chunks = [ ] # Check if a chunk fits def canHouse(self, chunk, index): if index > 1: if chunk.offset + chunk.size > self.chunks[index-1].offset: return False # We could test now that it fits in the memory return True # Farthest element is last def addChunk(self, new_chunk): index = 0 # Find first chunk whose value is bigger while index < len(self.chunks): offset = self.chunks[index].offset if offset < new_chunk.offset: if not self.canHouse(new_chunk, index): raise ParserError("Chunk '%s' doesn't fit!" % new_chunk.name) self.chunks.insert(index, new_chunk) return index += 1 # Not found or empty # We could at least check that it fits in the memory self.chunks.append(new_chunk) def yieldChunks(self, obj): while len(self.chunks) > 0: chunk = self.chunks.pop() current_pos = obj.current_size//8 # Check if padding needed size = chunk.offset - current_pos if size > 0: obj.info("Padding of %u bytes needed: curr=%u offset=%u" % \ (size, current_pos, chunk.offset)) yield PaddingBytes(obj, "padding[]", size) current_pos = obj.current_size//8 # Find resynch point if needed count = 0 old_off = chunk.offset while chunk.offset < current_pos: count += 1 chunk = self.chunks.pop() # Unfortunaly, we also pass the underlying chunks if chunk == None: obj.info("Couldn't resynch: %u object skipped to reach %u" % \ (count, current_pos)) return # Resynch size = chunk.offset-current_pos if size > 0: obj.info("Skipped %u objects to resynch to %u; chunk offset: %u->%u" % \ (count, current_pos, old_off, chunk.offset)) yield RawBytes(obj, "resynch[]", size) # Yield obj.info("Yielding element of size %u at offset %u" % \ (chunk.size, chunk.offset)) field = chunk.cls(obj, chunk.name, chunk.size, *chunk.args) # Not tested, probably wrong: #if chunk.size: field.static_size = 8*chunk.size yield field if hasattr(field, "getSubChunks"): for sub_chunk in field.getSubChunks(): obj.info("Adding sub chunk: position=%u size=%u name='%s'" % \ (sub_chunk.offset, sub_chunk.size, sub_chunk.name)) self.addChunk(sub_chunk) # Let missing padding be done by next chunk class S3MFlags(StaticFieldSet): format = ( (Bit, "st2_vibrato", "Vibrato (File version 1/ScreamTrack 2)"), (Bit, "st2_tempo", "Tempo (File version 1/ScreamTrack 2)"), (Bit, "amiga_slides", "Amiga slides (File version 1/ScreamTrack 2)"), (Bit, "zero_vol_opt", "Automatically turn off looping notes whose volume is zero for >2 note rows"), (Bit, "amiga_limits", "Disallow notes beyond Amiga hardware specs"), (Bit, "sb_processing", "Enable filter/SFX with SoundBlaster"), (Bit, "vol_slide", "Volume slide also performed on first row"), (Bit, "extended", "Special custom data in file"), (Bits, "unused[]", 8) ) def parseChannelType(val): val = val.value if val<8: return "Left Sample Channel %u" % val if val<16: return "Right Sample Channel %u" % (val-8) if val<32: return "Adlib channel %u" % (val-16) return "Value %u unknown" % val class ChannelSettings(FieldSet): static_size = 8 def createFields(self): yield textHandler(Bits(self, "type", 7), parseChannelType) yield Bit(self, "enabled") class ChannelPanning(FieldSet): static_size = 8 def createFields(self): yield Bits(self, "default_position", 4, "Default pan position") yield Bit(self, "reserved[]") yield Bit(self, "use_default", "Bits 0:3 specify default position") yield Bits(self, "reserved[]", 2) # Provide an automatic constructor class SizeFieldSet(FieldSet): """ Provide an automatic constructor for a sized field that can be aligned on byte positions according to ALIGN. Size is ignored if static_size is set. Real size is stored for convenience, but beware, it is not in bits, but in bytes. Field can be automatically padded, unless: - size is 0 (unknown, so padding doesn't make sense) - it shouldn't be aligned If it shouldn't be aligned, two solutions: - change _size to another value than the one found through aligment. - derive a class with ALIGN = 0. """ ALIGN = 16 def __init__(self, parent, name, size, desc=None): FieldSet.__init__(self, parent, name, desc) if size: self.real_size = size if self.static_size == None: self.setCheckedSizes(size) def setCheckedSizes(self, size): # First set size so that end is aligned, if needed self.real_size = size size *= 8 if self.ALIGN: size = alignValue(self.absolute_address+size, 8*self.ALIGN) \ - self.absolute_address if self._parent._size: if self._parent.current_size + size > self._parent._size: size = self._parent._size - self._parent.current_size self._size = size def createFields(self): for field in self.createUnpaddedFields(): yield field size = (self._size - self.current_size)//8 if size > 0: yield PaddingBytes(self, "padding", size) class Header(SizeFieldSet): def createDescription(self): return "%s (%u patterns, %u instruments)" % \ (self["title"].value, self["num_patterns"].value, self["num_instruments"].value) def createValue(self): return self["title"].value # Header fields may have to be padded - specify static_size # or modify _size in a derived class if never. def createUnpaddedFields(self): yield String(self, "title", 28, strip='\0') yield textHandler(UInt8(self, "marker[]"), hexadecimal) for field in self.getFileVersionField(): yield field yield UInt16(self, "num_orders") yield UInt16(self, "num_instruments") yield UInt16(self, "num_patterns") for field in self.getFirstProperties(): yield field yield String(self, "marker[]", 4) for field in self.getLastProperties(): yield field yield GenericVector(self, "channel_settings", 32, ChannelSettings, "channel") # Orders yield GenericVector(self, "orders", self.getNumOrders(), UInt8, "order") for field in self.getHeaderEndFields(): yield field class S3MHeader(Header): """ 0 1 2 3 4 5 6 7 8 9 A B C D E F +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0000: | Song name, max 28 chars (end with NUL (0)) | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0010: | |1Ah|Typ| x | x | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0020: |OrdNum |InsNum |PatNum | Flags | Cwt/v | Ffi |'S'|'C'|'R'|'M'| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0030: |g.v|i.s|i.t|m.v|u.c|d.p| x | x | x | x | x | x | x | x |Special| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0040: |Channel settings for 32 channels, 255=unused,+128=disabled | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0050: | | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0060: |Orders; length=OrdNum (should be even) | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx1: |Parapointers to instruments; length=InsNum*2 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx2: |Parapointers to patterns; length=PatNum*2 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx3: |Channel default pan positions | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx1=70h+orders xxx2=70h+orders+instruments*2 xxx3=70h+orders+instruments*2+patterns*2 """ def __init__(self, parent, name, size, desc=None): Header.__init__(self, parent, name, size, desc) # Overwrite real_size size = 0x60 + self["num_orders"].value + \ 2*(self["num_instruments"].value + self["num_patterns"].value) if self["panning_info"].value == 252: size += 32 # Deduce size for SizeFieldSet self.setCheckedSizes(size) def getFileVersionField(self): yield UInt8(self, "type") yield RawBytes(self, "reserved[]", 2) def getFirstProperties(self): yield S3MFlags(self, "flags") yield UInt8(self, "creation_version_minor") yield Bits(self, "creation_version_major", 4) yield Bits(self, "creation_version_unknown", 4, "(=1)") yield UInt16(self, "format_version") def getLastProperties(self): yield UInt8(self, "glob_vol", "Global volume") yield UInt8(self, "init_speed", "Initial speed (command A)") yield UInt8(self, "init_tempo", "Initial tempo (command T)") yield Bits(self, "volume", 7) yield Bit(self, "stereo") yield UInt8(self, "click_removal", "Number of GUS channels to run to prevent clicks") yield UInt8(self, "panning_info") yield RawBytes(self, "reserved[]", 8) yield UInt16(self, "custom_data_parapointer", "Parapointer to special custom data (not used by ST3.01)") def getNumOrders(self): return self["num_orders"].value def getHeaderEndFields(self): instr = self["num_instruments"].value patterns = self["num_patterns"].value # File pointers if instr > 0: yield GenericVector(self, "instr_pptr", instr, UInt16, "offset") if patterns > 0: yield GenericVector(self, "pattern_pptr", patterns, UInt16, "offset") # S3M 3.20 extension if self["creation_version_major"].value >= 3 \ and self["creation_version_minor"].value >= 0x20 \ and self["panning_info"].value == 252: yield GenericVector(self, "channel_panning", 32, ChannelPanning, "channel") # Padding required for 16B alignment size = self._size - self.current_size if size > 0: yield PaddingBytes(self, "padding", size//8) def getSubChunks(self): # Instruments - no warranty that they are concatenated for index in xrange(self["num_instruments"].value): yield Chunk(S3MInstrument, "instrument[]", 16*self["instr_pptr/offset[%u]" % index].value, S3MInstrument.static_size//8) # Patterns - size unknown but listed in their headers for index in xrange(self["num_patterns"].value): yield Chunk(S3MPattern, "pattern[]", 16*self["pattern_pptr/offset[%u]" % index].value, 0) class PTMHeader(Header): # static_size should prime over _size, right? static_size = 8*608 def getTrackerVersion(val): val = val.value return "ProTracker x%04X" % val def getFileVersionField(self): yield UInt16(self, "type") yield RawBytes(self, "reserved[]", 1) def getFirstProperties(self): yield UInt16(self, "channels") yield UInt16(self, "flags") # 0 => NullBytes yield UInt16(self, "reserved[]") def getLastProperties(self): yield RawBytes(self, "reserved[]", 16) def getNumOrders(self): return 256 def getHeaderEndFields(self): yield GenericVector(self, "pattern_pptr", 128, UInt16, "offset") def getSubChunks(self): # It goes like this in the BS: patterns->instruments->instr. samples if self._parent._size: min_off = self.absolute_address+self._parent._size else: min_off = 99999999999 # Instruments and minimal end position for last pattern count = self["num_instruments"].value addr = self.absolute_address for index in xrange(count): offset = (self.static_size+index*PTMInstrument.static_size)//8 yield Chunk(PTMInstrument, "instrument[]", offset, PTMInstrument.static_size//8) offset = self.stream.readBits(addr+8*(offset+18), 32, LITTLE_ENDIAN) min_off = min(min_off, offset) # Patterns count = self["num_patterns"].value prev_off = 16*self["pattern_pptr/offset[0]"].value for index in range(1, count): offset = 16*self["pattern_pptr/offset[%u]" % index].value yield Chunk(PTMPattern, "pattern[]", prev_off, offset-prev_off) prev_off = offset # Difficult to account for yield Chunk(PTMPattern, "pattern[]", prev_off, min_off-prev_off) class SampleFlags(StaticFieldSet): format = ( (Bit, "loop_on"), (Bit, "stereo", "Sample size will be 2*length"), (Bit, "16bits", "16b sample, Intel LO-HI byteorder"), (Bits, "unused", 5) ) class S3MUInt24(Field): static_size = 24 def __init__(self, parent, name, desc=None): Field.__init__(self, parent, name, size=24, description=desc) addr = self.absolute_address val = parent.stream.readBits(addr, 8, LITTLE_ENDIAN) << 20 val += parent.stream.readBits(addr+8, 16, LITTLE_ENDIAN) << 4 self.createValue = lambda: val class SampleData(SizeFieldSet): def createUnpaddedFields(self): yield RawBytes(self, "data", self.real_size) class PTMSampleData(SampleData): ALIGN = 0 class Instrument(SizeFieldSet): static_size = 8*0x50 def createDescription(self): info = [self["c4_speed"].display] if "flags/stereo" in self: if self["flags/stereo"].value: info.append("stereo") else: info.append("mono") info.append("%u bits" % self.getSampleBits()) return ", ".join(info) # Structure knows its size and doesn't need padding anyway, so # overwrite base member: no need to go through it. def createFields(self): yield self.getType() yield String(self, "filename", 12, strip='\0') for field in self.getInstrumentFields(): yield field yield String(self, "name", 28, strip='\0') yield String(self, "marker", 4, "Either 'SCRS' or '(empty)'", strip='\0') def createValue(self): return self["name"].value class S3MInstrument(Instrument): """ In fact a sample. Description follows: 0 1 2 3 4 5 6 7 8 9 A B C D E F +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0000: |[T]| Dos filename (12345678.ABC) | MemSeg | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0010: |Length |HI:leng|LoopBeg|HI:LBeg|LoopEnd|HI:Lend|Vol| x |[P]|[F]| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0020: |C2Spd |HI:C2sp| x | x | x | x |Int:Gp |Int:512|Int:lastused | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0030: | Sample name, 28 characters max... (incl. NUL) | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0040: | ...sample name... |'S'|'C'|'R'|'S'| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxxx: sampledata """ MAGIC = "SCRS" PACKING = {0: "Unpacked", 1: "DP30ADPCM" } TYPE = {0: "Unknown", 1: "Sample", 2: "adlib melody", 3: "adlib drum2" } def getType(self): return Enum(UInt8(self, "type"), self.TYPE) def getSampleBits(self): return 8*(1+self["flags/16bits"].value) def getInstrumentFields(self): yield S3MUInt24(self, "sample_offset") yield UInt32(self, "sample_size") yield UInt32(self, "loop_begin") yield UInt32(self, "loop_end") yield UInt8(self, "volume") yield UInt8(self, "reserved[]") yield Enum(UInt8(self, "packing"), self.PACKING) yield SampleFlags(self, "flags") yield UInt32(self, "c4_speed", "Frequency for middle C note") yield UInt32(self, "reserved[]", 4) yield UInt16(self, "internal[]", "Sample address in GUS memory") yield UInt16(self, "internal[]", "Flags for SoundBlaster loop expansion") yield UInt32(self, "internal[]", "Last used position (SB)") def getSubChunks(self): size = self["sample_size"].value if self["flags/stereo"].value: size *= 2 if self["flags/16bits"].value: size *= 2 yield Chunk(SampleData, "sample_data[]", self["sample_offset"].value, size) class PTMType(FieldSet): TYPES = {0: "No sample", 1: "Regular", 2: "OPL2/OPL2 instrument", 3: "MIDI instrument" } static_size = 8 def createFields(self): yield Bits(self, "unused", 2) yield Bit(self, "is_tonable") yield Bit(self, "16bits") yield Bit(self, "loop_bidir") yield Bit(self, "loop") yield Enum(Bits(self, "origin", 2), self.TYPES) ##class PTMType(StaticFieldSet): ## format = ( ## (Bits, "unused", 2), ## (Bit, "is_tonable"), ## (Bit, "16bits"), ## (Bit, "loop_bidir"), ## (Bit, "loop"), ## (Bits, "origin", 2), ## ) class PTMInstrument(Instrument): MAGIC = "PTMI" ALIGN = 0 def getType(self): return PTMType(self, "flags") # Hack to have more common code # PTM doesn't pretend to manage 16bits def getSampleBits(self): return 8 def getInstrumentFields(self): yield UInt8(self, "volume") yield UInt16(self, "c4_speed") yield UInt16(self, "sample_segment") yield UInt32(self, "sample_offset") yield UInt32(self, "sample_size") yield UInt32(self, "loop_begin") yield UInt32(self, "loop_end") yield UInt32(self, "gus_begin") yield UInt32(self, "gus_loop_start") yield UInt32(self, "gus_loop_end") yield textHandler(UInt8(self, "gus_loop_flags"), hexadecimal) yield UInt8(self, "reserved[]") # Should be 0 def getSubChunks(self): # Samples are NOT padded, and the size is already the correct one size = self["sample_size"].value if size: yield Chunk(PTMSampleData, "sample_data[]", self["sample_offset"].value, size) class S3MNoteInfo(StaticFieldSet): """ 0=end of row &31=channel &32=follows; BYTE:note, BYTE:instrument &64=follows; BYTE:volume &128=follows; BYTE:command, BYTE:info """ format = ( (Bits, "channel", 5), (Bit, "has_note"), (Bit, "has_volume"), (Bit, "has_effect") ) class PTMNoteInfo(StaticFieldSet): format = ( (Bits, "channel", 5), (Bit, "has_note"), (Bit, "has_effect"), (Bit, "has_volume") ) class Note(FieldSet): def createFields(self): # Used by Row to check if end of Row info = self.NOTE_INFO(self, "info") yield info if info["has_note"].value: yield UInt8(self, "note") yield UInt8(self, "instrument") if info["has_volume"].value: yield UInt8(self, "volume") if info["has_effect"].value: yield UInt8(self, "effect") yield UInt8(self, "param") class S3MNote(Note): NOTE_INFO = S3MNoteInfo class PTMNote(Note): NOTE_INFO = PTMNoteInfo class Row(FieldSet): def createFields(self): addr = self.absolute_address while True: # Check empty note byte = self.stream.readBits(addr, 8, self.endian) if not byte: yield NullBytes(self, "terminator", 1) return note = self.NOTE(self, "note[]") yield note addr += note.size class S3MRow(Row): NOTE = S3MNote class PTMRow(Row): NOTE = PTMNote class Pattern(SizeFieldSet): def createUnpaddedFields(self): count = 0 while count < 64 and not self.eof: yield self.ROW(self, "row[]") count += 1 class S3MPattern(Pattern): ROW = S3MRow def __init__(self, parent, name, size, desc=None): Pattern.__init__(self, parent, name, size, desc) # Get real_size from header addr = self.absolute_address size = self.stream.readBits(addr, 16, LITTLE_ENDIAN) self.setCheckedSizes(size) class PTMPattern(Pattern): ROW = PTMRow class Module(Parser): # MARKER / HEADER are defined in derived classes endian = LITTLE_ENDIAN def validate(self): marker = self.stream.readBits(0x1C*8, 8, LITTLE_ENDIAN) if marker != 0x1A: return "Invalid start marker %u" % marker marker = self.stream.readBytes(0x2C*8, 4) if marker != self.MARKER: return "Invalid marker %s!=%s" % (marker, self.MARKER) return True def createFields(self): # Index chunks indexer = ChunkIndexer() # Add header - at least 0x50 bytes indexer.addChunk(Chunk(self.HEADER, "header", 0, 0x50)) for field in indexer.yieldChunks(self): yield field class S3MModule(Module): PARSER_TAGS = { "id": "s3m", "category": "audio", "file_ext": ("s3m",), "mime": (u'audio/s3m', u'audio/x-s3m'), "min_size": 64*8, "description": "ScreamTracker3 module" } MARKER = "SCRM" HEADER = S3MHeader ## def createContentSize(self): ## hdr = Header(self, "header") ## max_offset = hdr._size//8 ## instr_size = Instrument._size//8 ## for index in xrange(self["header/num_instruments"].value): ## offset = 16*hdr["instr_pptr/offset[%u]" % index].value ## max_offset = max(offset+instr_size, max_offset) ## addr = self.absolute_address + 8*offset class PTMModule(Module): PARSER_TAGS = { "id": "ptm", "category": "audio", "file_ext": ("ptm",), "min_size": 64*8, "description": "PolyTracker module (v1.17)" } MARKER = "PTMF" HEADER = PTMHeader
24,149
Python
.py
566
34.169611
108
0.560922
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,611
mpeg_audio.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/mpeg_audio.py
""" MPEG audio file parser. Creation: 12 decembre 2005 Author: Victor Stinner """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, MissingField, ParserError, createOrphanField, Bit, Bits, Enum, PaddingBits, PaddingBytes, RawBytes) from hachoir_parser.audio.id3 import ID3v1, ID3v2 from hachoir_core.endian import BIG_ENDIAN from hachoir_core.tools import humanFrequency, humanBitSize from hachoir_core.bits import long2raw from hachoir_core.error import HACHOIR_ERRORS from hachoir_core.stream import InputStreamError # Max MP3 filesize: 200 MB MAX_FILESIZE = 200*1024*1024*8 class Frame(FieldSet): VERSION_NAME = { 0: "2.5", 2: "2", 3: "1" } MPEG_I = 3 MPEG_II = 2 MPEG_II_5 = 0 LAYER_NAME = { 1: "III", 2: "II", 3: "I" } LAYER_I = 3 LAYER_II = 2 LAYER_III = 1 # Bit rates (bit_rate * 1000 = bits/sec) # key 15 is always invalid BIT_RATES = { 1: ( # MPEG1 ( 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 ), # layer I ( 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 ), # layer II ( 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 ), # layer III # - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - ), 2: ( # MPEG2 / MPEG2.5 ( 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 ), # layer I ( 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 ), # layer II ( 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 ), # layer III # - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - ) } SAMPLING_RATES = { 3: {0: 44100, 1: 48000, 2: 32000}, # MPEG1 2: {0: 22050, 1: 24000, 2: 16000}, # MPEG2 0: {0: 11025, 1: 12000, 2: 8000} # MPEG2.5 } EMPHASIS_NAME = {0: "none", 1: "50/15 ms", 3: "CCIT J.17"} CHANNEL_MODE_NAME = { 0: "Stereo", 1: "Joint stereo", 2: "Dual channel", 3: "Single channel" } # Channel mode => number of channels NB_CHANNEL = { 0: 2, 1: 2, 2: 2, 3: 1, } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) if not self._size: frame_size = self.getFrameSize() if not frame_size: raise ParserError("MPEG audio: Invalid frame %s" % self.path) self._size = min(frame_size * 8, self.parent.size - self.address) def createFields(self): # Header yield PaddingBits(self, "sync", 11, "Synchronize bits (set to 1)", pattern=1) yield Enum(Bits(self, "version", 2, "MPEG audio version"), self.VERSION_NAME) yield Enum(Bits(self, "layer", 2, "MPEG audio layer"), self.LAYER_NAME) yield Bit(self, "crc16", "No CRC16 protection?") # Rates and padding yield Bits(self, "bit_rate", 4, "Bit rate") yield Bits(self, "sampling_rate", 2, "Sampling rate") yield Bit(self, "use_padding", "Stream field use padding?") yield Bit(self, "extension", "Extension") # Channel mode, mode extension, copyright, ... yield Enum(Bits(self, "channel_mode", 2, "Channel mode"), self.CHANNEL_MODE_NAME) yield Bits(self, "mode_ext", 2, "Mode extension") yield Bit(self, "copyright", "Is copyrighted?") yield Bit(self, "original", "Is original?") yield Enum(Bits(self, "emphasis", 2, "Emphasis"), self.EMPHASIS_NAME) size = (self.size - self.current_size) / 8 if size: yield RawBytes(self, "data", size) def isValid(self): return (self["layer"].value != 0 and self["sync"].value == 2047 and self["version"].value != 1 and self["sampling_rate"].value != 3 and self["bit_rate"].value not in (0, 15) and self["emphasis"].value != 2) def getSampleRate(self): """ Read sampling rate. Returns None on error. """ version = self["version"].value rate = self["sampling_rate"].value try: return self.SAMPLING_RATES[version][rate] except (KeyError, IndexError): return None def getBitRate(self): """ Read bit rate in bit/sec. Returns None on error. """ layer = 3 - self["layer"].value bit_rate = self["bit_rate"].value if bit_rate in (0, 15): return None if self["version"].value == 3: dataset = self.BIT_RATES[1] # MPEG1 else: dataset = self.BIT_RATES[2] # MPEG2 / MPEG2.5 try: return dataset[layer][bit_rate] * 1000 except (KeyError, IndexError): return None def getFrameSize(self): """ Read frame size in bytes. Returns None on error. """ frame_size = self.getBitRate() if not frame_size: return None sample_rate = self.getSampleRate() if not sample_rate: return None padding = int(self["use_padding"].value) if self["layer"].value == self.LAYER_III: if self["version"].value == self.MPEG_I: return (frame_size * 144) // sample_rate + padding else: return (frame_size * 72) // sample_rate + padding elif self["layer"].value == self.LAYER_II: return (frame_size * 144) / sample_rate + padding else: # self.LAYER_I: frame_size = (frame_size * 12) / sample_rate return (frame_size + padding) * 4 def getNbChannel(self): return self.NB_CHANNEL[ self["channel_mode"].value ] def createDescription(self): info = ["layer %s" % self["layer"].display] bit_rate = self.getBitRate() if bit_rate: info.append("%s/sec" % humanBitSize(bit_rate)) sampling_rate = self.getSampleRate() if sampling_rate: info.append(humanFrequency(sampling_rate)) return "MPEG-%s %s" % (self["version"].display, ", ".join(info)) def findSynchronizeBits(parser, start, max_size): """ Find synchronisation bits (11 bits set to 1) Returns None on error, or number of bytes before the synchronization. """ address0 = parser.absolute_address end = start + max_size size = 0 while start < end: # Fast search: search 0xFF (first byte of sync frame field) length = parser.stream.searchBytesLength("\xff", False, start, end) if length is None: return None size += length start += length * 8 # Strong validation of frame: create the frame # and call method isValid() try: frame = createOrphanField(parser, start-address0, Frame, "frame") valid = frame.isValid() except HACHOIR_ERRORS: valid = False if valid: return size # Invalid frame: continue start += 8 size += 1 return None class Frames(FieldSet): # Padding bytes allowed before a frame MAX_PADDING = 256 def synchronize(self): addr = self.absolute_address start = addr + self.current_size end = min(start + self.MAX_PADDING*8, addr + self.size) padding = findSynchronizeBits(self, start, end) if padding is None: raise ParserError("MPEG audio: Unable to find synchronization bits") if padding: return PaddingBytes(self, "padding[]", padding, "Padding before synchronization") else: return None def looksConstantBitRate(self, count=10): """ Guess if frames are constant bit rate. If it returns False, you can be sure that frames are variable bit rate. Otherwise, it looks like constant bit rate (on first count fields). """ check_keys = ("version", "layer", "bit_rate") last_field = None for index, field in enumerate(self.array("frame")): if last_field: for key in check_keys: if field[key].value != last_field[key].value: return False last_field = field if index == count: break return True def createFields(self): # Find synchronisation bytes padding = self.synchronize() if padding: yield padding while self.current_size < self.size: yield Frame(self, "frame[]") # padding = self.synchronize() # if padding: # yield padding # Read raw bytes at the end (if any) size = (self.size - self.current_size) / 8 if size: yield RawBytes(self, "raw", size) def createDescription(self): if self.looksConstantBitRate(): text = "(looks like) Constant bit rate (CBR)" else: text = "Variable bit rate (VBR)" return "Frames: %s" % text def createMpegAudioMagic(): # ID3v1 magic magics = [("TAG", 0)] # ID3v2 magics for ver_major in ID3v2.VALID_MAJOR_VERSIONS: magic = "ID3%c\x00" % ver_major magics.append( (magic,0) ) # MPEG frame magic # TODO: Use longer magic: 32 bits instead of 16 bits SYNC_BITS = 2047 for version in Frame.VERSION_NAME.iterkeys(): for layer in Frame.LAYER_NAME.iterkeys(): for crc16 in (0, 1): magic = (SYNC_BITS << 5) | (version << 3) | (layer << 1) | crc16 magic = long2raw(magic, BIG_ENDIAN, 2) magics.append( (magic, 0) ) return magics class MpegAudioFile(Parser): PARSER_TAGS = { "id": "mpeg_audio", "category": "audio", "file_ext": ("mpa", "mp1", "mp2", "mp3"), "mime": (u"audio/mpeg",), "min_size": 4*8, # "magic": createMpegAudioMagic(), "description": "MPEG audio version 1, 2, 2.5", "subfile": "skip", } endian = BIG_ENDIAN def validate(self): if self[0].name in ("id3v2", "id3v1"): return True if not self.stream.checked: # TODO: is it possible to handle piped input? return False # Validate first 5 frames for index in xrange(5): try: frame = self["frames/frame[%u]" % index] except MissingField: # Require a least one valid frame if (1 <= index) \ and self["frames"].done: return True return "Unable to get frame #%u" % index except (InputStreamError, ParserError): return "Unable to create frame #%u" % index # Check first frame values if not frame.isValid(): return "Frame #%u is invalid" % index # Check that all frames are similar if not index: frame0 = frame else: if frame0["channel_mode"].value != frame["channel_mode"].value: return "Frame #%u channel mode is different" % index return True def createFields(self): # Read ID3v2 (if any) if self.stream.readBytes(0, 3) == "ID3": yield ID3v2(self, "id3v2") if self._size is None: # TODO: is it possible to handle piped input? raise NotImplementedError # Check if file is ending with ID3v1 or not and compute frames size frames_size = self.size - self.current_size addr = self.size - 128*8 if 0 <= addr: has_id3 = (self.stream.readBytes(addr, 3) == "TAG") if has_id3: frames_size -= 128*8 else: has_id3 = False # Read frames (if any) if frames_size: yield Frames(self, "frames", size=frames_size) # Read ID3v1 (if any) if has_id3: yield ID3v1(self, "id3v1") def createDescription(self): if "frames" in self: frame = self["frames/frame[0]"] return "%s, %s" % (frame.description, frame["channel_mode"].display) elif "id3v2" in self: return self["id3v2"].description elif "id3v1" in self: return self["id3v1"].description else: return "MPEG audio" def createContentSize(self): # Get "frames" field field = self[0] if field.name != "frames": try: field = self[1] except MissingField: # File only contains ID3v1 or ID3v2 return field.size # Error: second field are not the frames"? if field.name != "frames": return None # Go to last frame frames = field frame = frames["frame[0]"] address0 = field.absolute_address size = address0 + frame.size while True: try: # Parse one MPEG audio frame frame = createOrphanField(frames, size - address0, Frame, "frame") # Check frame 32 bits header if not frame.isValid(): break except HACHOIR_ERRORS: break if MAX_FILESIZE < (size + frame.size): break size += frame.size # ID3v1 at the end? try: if self.stream.readBytes(size, 3) == "TAG": size += ID3v1.static_size except InputStreamError, err: pass return size
13,757
Python
.py
357
28.893557
99
0.550528
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,612
aiff.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/aiff.py
""" Audio Interchange File Format (AIFF) parser. Author: Victor Stinner Creation: 27 december 2006 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt16, UInt32, Float80, TimestampMac32, RawBytes, NullBytes, String, Enum, PascalString32) from hachoir_core.endian import BIG_ENDIAN from hachoir_core.text_handler import filesizeHandler from hachoir_core.tools import alignValue from hachoir_parser.audio.id3 import ID3v2 CODEC_NAME = { 'ACE2': u"ACE 2-to-1", 'ACE8': u"ACE 8-to-3", 'MAC3': u"MAC 3-to-1", 'MAC6': u"MAC 6-to-1", 'NONE': u"None", 'sowt': u"Little-endian, no compression", } class Comment(FieldSet): def createFields(self): yield TimestampMac32(self, "timestamp") yield PascalString32(self, "text") def parseText(self): yield String(self, "text", self["size"].value) def parseID3(self): yield ID3v2(self, "id3v2", size=self["size"].value*8) def parseComment(self): yield UInt16(self, "nb_comment") for index in xrange(self["nb_comment"].value): yield Comment(self, "comment[]") def parseCommon(self): yield UInt16(self, "nb_channel") yield UInt32(self, "nb_sample") yield UInt16(self, "sample_size") yield Float80(self, "sample_rate") yield Enum(String(self, "codec", 4, strip="\0", charset="ASCII"), CODEC_NAME) def parseVersion(self): yield TimestampMac32(self, "timestamp") def parseSound(self): yield UInt32(self, "offset") yield UInt32(self, "block_size") size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "data", size) class Chunk(FieldSet): TAG_INFO = { 'COMM': ('common', "Common chunk", parseCommon), 'COMT': ('comment', "Comment", parseComment), 'NAME': ('name', "Name", parseText), 'AUTH': ('author', "Author", parseText), 'FVER': ('version', "Version", parseVersion), 'SSND': ('sound', "Sound data", parseSound), 'ID3 ': ('id3', "ID3", parseID3), } def __init__(self, *args): FieldSet.__init__(self, *args) self._size = (8 + alignValue(self["size"].value, 2)) * 8 tag = self["type"].value if tag in self.TAG_INFO: self._name, self._description, self._parser = self.TAG_INFO[tag] else: self._parser = None def createFields(self): yield String(self, "type", 4, "Signature (FORM)", charset="ASCII") yield filesizeHandler(UInt32(self, "size")) size = self["size"].value if size: if self._parser: for field in self._parser(self): yield field if size % 2: yield NullBytes(self, "padding", 1) else: yield RawBytes(self, "data", size) class AiffFile(Parser): PARSER_TAGS = { "id": "aiff", "category": "audio", "file_ext": ("aif", "aiff", "aifc"), "mime": (u"audio/x-aiff",), "magic_regex": (("FORM.{4}AIF[CF]", 0),), "min_size": 12*8, "description": "Audio Interchange File Format (AIFF)" } endian = BIG_ENDIAN def validate(self): if self.stream.readBytes(0, 4) != "FORM": return "Invalid signature" if self.stream.readBytes(8*8, 4) not in ("AIFF", "AIFC"): return "Invalid type" return True def createFields(self): yield String(self, "signature", 4, "Signature (FORM)", charset="ASCII") yield filesizeHandler(UInt32(self, "filesize")) yield String(self, "type", 4, "Form type (AIFF or AIFC)", charset="ASCII") while not self.eof: yield Chunk(self, "chunk[]") def createDescription(self): if self["type"].value == "AIFC": return "Audio Interchange File Format Compressed (AIFC)" else: return "Audio Interchange File Format (AIFF)" def createContentSize(self): return self["filesize"].value * 8
4,019
Python
.py
108
30.185185
82
0.609455
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,613
modplug.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/modplug.py
""" Modplug metadata inserted into module files. Doc: - http://modplug.svn.sourceforge.net/viewvc/modplug/trunk/modplug/soundlib/ Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 10th February 2007 """ from hachoir_core.field import (FieldSet, UInt32, UInt16, UInt8, Int8, Float32, RawBytes, String, GenericVector, ParserError) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal MAX_ENVPOINTS = 32 def parseComments(parser): size = parser["block_size"].value if size > 0: yield String(parser, "comment", size) class MidiOut(FieldSet): static_size = 9*32*8 def createFields(self): for name in ("start", "stop", "tick", "noteon", "noteoff", "volume", "pan", "banksel", "program"): yield String(self, name, 32, strip='\0') class Command(FieldSet): static_size = 32*8 def createFields(self): start = self.absolute_address size = self.stream.searchBytesLength("\0", False, start) if size > 0: self.info("Command: %s" % self.stream.readBytes(start, size)) yield String(self, "command", size, strip='\0') yield RawBytes(self, "parameter", (self._size//8)-size) class MidiSFXExt(FieldSet): static_size = 16*32*8 def createFields(self): for index in xrange(16): yield Command(self, "command[]") class MidiZXXExt(FieldSet): static_size = 128*32*8 def createFields(self): for index in xrange(128): yield Command(self, "command[]") def parseMidiConfig(parser): yield MidiOut(parser, "midi_out") yield MidiSFXExt(parser, "sfx_ext") yield MidiZXXExt(parser, "zxx_ext") def parseChannelSettings(parser): size = parser["block_size"].value//4 if size > 0: yield GenericVector(parser, "settings", size, UInt32, "mix_plugin") def parseEQBands(parser): size = parser["block_size"].value//4 if size > 0: yield GenericVector(parser, "gains", size, UInt32, "band") class SoundMixPluginInfo(FieldSet): static_size = 128*8 def createFields(self): yield textHandler(UInt32(self, "plugin_id1"), hexadecimal) yield textHandler(UInt32(self, "plugin_id2"), hexadecimal) yield UInt32(self, "input_routing") yield UInt32(self, "output_routing") yield GenericVector(self, "routing_info", 4, UInt32, "reserved") yield String(self, "name", 32, strip='\0') yield String(self, "dll_name", 64, desc="Original DLL name", strip='\0') class ExtraData(FieldSet): def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) self._size = (4+self["size"].value)*8 def createFields(self): yield UInt32(self, "size") size = self["size"].value if size: yield RawBytes(self, "data", size) class XPlugData(FieldSet): def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) self._size = (4+self["size"].value)*8 def createFields(self): yield UInt32(self, "size") while not self.eof: yield UInt32(self, "marker") if self["marker"].value == 'DWRT': yield Float32(self, "dry_ratio") elif self["marker"].value == 'PORG': yield UInt32(self, "default_program") def parsePlugin(parser): yield SoundMixPluginInfo(parser, "info") # Check if VST setchunk present size = parser.stream.readBits(parser.absolute_address+parser.current_size, 32, LITTLE_ENDIAN) if 0 < size < parser.current_size + parser._size: yield ExtraData(parser, "extra_data") # Check if XPlugData is present size = parser.stream.readBits(parser.absolute_address+parser.current_size, 32, LITTLE_ENDIAN) if 0 < size < parser.current_size + parser._size: yield XPlugData(parser, "xplug_data") # Format: "XXXX": (type, count, name) EXTENSIONS = { # WriteInstrumentHeaderStruct@Sndfile.cpp "XTPM": { "..Fd": (UInt32, 1, "Flags"), "..OF": (UInt32, 1, "Fade out"), "..VG": (UInt32, 1, "Global Volume"), "...P": (UInt32, 1, "Panning"), "..EV": (UInt32, 1, "Volume Envelope"), "..EP": (UInt32, 1, "Panning Envelope"), ".EiP": (UInt32, 1, "Pitch Envelope"), ".SLV": (UInt8, 1, "Volume Loop Start"), ".ELV": (UInt8, 1, "Volume Loop End"), ".BSV": (UInt8, 1, "Volume Sustain Begin"), ".ESV": (UInt8, 1, "Volume Sustain End"), ".SLP": (UInt8, 1, "Panning Loop Start"), ".ELP": (UInt8, 1, "Panning Loop End"), ".BSP": (UInt8, 1, "Panning Substain Begin"), ".ESP": (UInt8, 1, "Padding Substain End"), "SLiP": (UInt8, 1, "Pitch Loop Start"), "ELiP": (UInt8, 1, "Pitch Loop End"), "BSiP": (UInt8, 1, "Pitch Substain Begin"), "ESiP": (UInt8, 1, "Pitch Substain End"), ".ANN": (UInt8, 1, "NNA"), ".TCD": (UInt8, 1, "DCT"), ".AND": (UInt8, 1, "DNA"), "..SP": (UInt8, 1, "Panning Swing"), "..SV": (UInt8, 1, "Volume Swing"), ".CFI": (UInt8, 1, "IFC"), ".RFI": (UInt8, 1, "IFR"), "..BM": (UInt32, 1, "Midi Bank"), "..PM": (UInt8, 1, "Midi Program"), "..CM": (UInt8, 1, "Midi Channel"), ".KDM": (UInt8, 1, "Midi Drum Key"), ".SPP": (Int8, 1, "PPS"), ".CPP": (UInt8, 1, "PPC"), ".[PV": (UInt32, MAX_ENVPOINTS, "Volume Points"), ".[PP": (UInt32, MAX_ENVPOINTS, "Panning Points"), "[PiP": (UInt32, MAX_ENVPOINTS, "Pitch Points"), ".[EV": (UInt8, MAX_ENVPOINTS, "Volume Enveloppe"), ".[EP": (UInt8, MAX_ENVPOINTS, "Panning Enveloppe"), "[EiP": (UInt8, MAX_ENVPOINTS, "Pitch Enveloppe"), ".[MN": (UInt8, 128, "Note Mapping"), "..[K": (UInt32, 128, "Keyboard"), "..[n": (String, 32, "Name"), ".[nf": (String, 12, "Filename"), ".PiM": (UInt8, 1, "MixPlug"), "..RV": (UInt16, 1, "Volume Ramping"), "...R": (UInt16, 1, "Resampling"), "..SC": (UInt8, 1, "Cut Swing"), "..SR": (UInt8, 1, "Res Swing"), "..MF": (UInt8, 1, "Filter Mode"), }, # See after "CODE tag dictionary", same place, elements with [EXT] "STPM": { "...C": (UInt32, 1, "Channels"), ".VWC": (None, 0, "CreatedWith version"), ".VGD": (None, 0, "Default global volume"), "..TD": (None, 0, "Default tempo"), "HIBE": (None, 0, "Embedded instrument header"), "VWSL": (None, 0, "LastSavedWith version"), ".MMP": (None, 0, "Plugin Mix mode"), ".BPR": (None, 0, "Rows per beat"), ".MPR": (None, 0, "Rows per measure"), "@PES": (None, 0, "Chunk separator"), ".APS": (None, 0, "Song Pre-amplification"), "..MT": (None, 0, "Tempo mode"), "VTSV": (None, 0, "VSTi volume"), } } class MPField(FieldSet): def __init__(self, parent, name, ext, desc=None): FieldSet.__init__(self, parent, name, desc) self.ext = ext self.info(self.createDescription()) self._size = (6+self["data_size"].value)*8 def createFields(self): # Identify tag code = self.stream.readBytes(self.absolute_address, 4) if code in self.ext: cls, count, comment = self.ext[code] else: cls, count, comment = RawBytes, 1, "Unknown tag" # Header yield String(self, "code", 4, comment) yield UInt16(self, "data_size") # Data if not cls: size = self["data_size"].value if size > 0: yield RawBytes(self, "data", size) elif cls in (String, RawBytes): yield cls(self, "value", count) else: if count > 1: yield GenericVector(self, "values", count, cls, "item") else: yield cls(self, "value") def createDescription(self): return "Element '%s', size %i" % \ (self["code"]._description, self["data_size"].value) def parseFields(parser): # Determine field names ext = EXTENSIONS[parser["block_type"].value] if ext == None: raise ParserError("Unknown parent '%s'" % parser["block_type"].value) # Parse fields addr = parser.absolute_address + parser.current_size while not parser.eof and parser.stream.readBytes(addr, 4) in ext: field = MPField(parser, "field[]", ext) yield field addr += field._size # Abort on unknown codes parser.info("End of extension '%s' when finding '%s'" % (parser["block_type"].value, parser.stream.readBytes(addr, 4))) class ModplugBlock(FieldSet): BLOCK_INFO = { "TEXT": ("comment", True, "Comment", parseComments), "MIDI": ("midi_config", True, "Midi configuration", parseMidiConfig), "XFHC": ("channel_settings", True, "Channel settings", parseChannelSettings), "XTPM": ("instrument_ext", False, "Instrument extensions", parseFields), "STPM": ("song_ext", False, "Song extensions", parseFields), } def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) self.parseBlock = parsePlugin t = self["block_type"].value self.has_size = False if t in self.BLOCK_INFO: self._name, self.has_size, desc, parseBlock = self.BLOCK_INFO[t] if callable(desc): self.createDescription = lambda: desc(self) if parseBlock: self.parseBlock = lambda: parseBlock(self) if self.has_size: self._size = 8*(self["block_size"].value + 8) def createFields(self): yield String(self, "block_type", 4) if self.has_size: yield UInt32(self, "block_size") if self.parseBlock: for field in self.parseBlock(): yield field if self.has_size: size = self["block_size"].value - (self.current_size//8) if size > 0: yield RawBytes(self, "data", size, "Unknown data") def ParseModplugMetadata(parser): while not parser.eof: block = ModplugBlock(parser, "block[]") yield block if block["block_type"].value == "STPM": break # More undocumented stuff: date ? size = (parser._size - parser.absolute_address - parser.current_size)//8 if size > 0: yield RawBytes(parser, "info", size)
10,655
Python
.py
252
33.968254
97
0.579795
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,614
au.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/au.pyc
—Ú Œ »Mc@sédZddklZddklZlZlZlZddkl Z ddk l Z l Z ddk lZlZdefdÑÉYZd S( sE AU audio file parser Author: Victor Stinner Creation: 12 july 2006 iˇˇˇˇ(tParser(tUInt32tEnumtStringtRawBytes(t BIG_ENDIAN(tdisplayHandlertfilesizeHandler(t createDictthumanFrequencytAuFilecBs3eZhdd6dd6dBd6dCd6dDd 6dFd6dd6ZeZhdGd6dHd6dId6dJd6dKd6dLd6dMd!6dOd 6dPd$6dQd&6dRd(6dSd*6dTd,6dUd.6dVd06dWd26dXd46dYd66dZd 6d[d96d\d;6d]d=6Zeed ÉZeedÉZ e d^ÉZ d>ÑZ d?ÑZ d@ÑZdAÑZRS(_t sun_next_sndtidtaudiotcategorytautsndtfile_extu audio/basictmimeiitmin_sizes.snditmagicsSun/NeXT audiot descriptionu8-bit ISDN u-lawiu8-bit linear PCMiiu16-bit linear PCMiu24-bit linear PCMii u32-bit linear PCMiu32-bit IEEE floating pointii@u64-bit IEEE floating pointiuFragmented sample datau DSP programi u8-bit fixed pointi u16-bit fixed pointi u24-bit fixed pointi u32-bit fixed pointi u16-bit linear with emphasisiu16-bit linear compressediu+16-bit linear with emphasis and compressioniuMusic kit DSP commandsiu/4-bit ISDN u-law compressed (CCITT G.721 ADPCM)iuITU-T G.722 ADPCMuITU-T G.723 3-bit ADPCMiuITU-T G.723 5-bit ADPCMiu8-bit ISDN A-lawicCsA|iiddÉdjodS|di|ijodStS(Niis.sndsWrong file signaturetchannelssInvalid number of channel(tstreamt readBytestvaluetVALID_NB_CHANNELtTrue(tself((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/au.pytvalidate9s cCs|ii|diÉS(s| Get bit rate (number of bit per sample per channel), may returns None if you unable to compute it. tcodec(tBITS_PER_SAMPLEtgetR(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/au.pytgetBitsPerSample@sc cst|dddddÉVt|ddÉVtt|dd ÉÉVtt|d d É|iÉVtt|d d ÉtÉVt|ddÉV|di|id}d|jo$t|d|dddddÉVnt |di|i |idÉ}t |d|dÉVdS(Nt signatureisFormat signature (".snd")tcharsettASCIItdata_ofss Data offsett data_sizes Data sizeRs Audio codect sample_ratesNumber of samples/secondRsNumber of interleaved channelsiitinfot Informationtstrips s ISO-8859-1t audio_datas Audio data( RRRRt CODEC_NAMERR Rt current_sizetmintsizeR(RR/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/au.pyt createFieldsGs $$cCs|di|didS(NR%R&i(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/au.pytcreateContentSizeVs(RR(u audio/basici¿(s.sndi((s.sndi(iu8-bit ISDN u-law(iu8-bit linear PCM(iu16-bit linear PCM(iu24-bit linear PCM(i u32-bit linear PCM(i u32-bit IEEE floating point(i@u64-bit IEEE floating pointN(NuFragmented sample data(Nu DSP program(iu8-bit fixed point(iu16-bit fixed point(iu24-bit fixed point(i u32-bit fixed point(iu16-bit linear with emphasis(iu16-bit linear compressed(iu+16-bit linear with emphasis and compression(NuMusic kit DSP commands(Nu/4-bit ISDN u-law compressed (CCITT G.721 ADPCM)(NuITU-T G.722 ADPCM(NuITU-T G.723 3-bit ADPCM(NuITU-T G.723 5-bit ADPCM(iu8-bit ISDN A-law(ii(t__name__t __module__t PARSER_TAGSRtendiantNonet CODEC_INFORRR,tsetRRR!R0R1(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/au.pyR sN      N(t__doc__thachoir_parserRthachoir_core.fieldRRRRthachoir_core.endianRthachoir_core.text_handlerRRthachoir_core.toolsRR R (((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/au.pyt<module>s "
4,959
Python
.py
29
169.137931
1,314
0.519675
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,615
__init__.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/__init__.py
from hachoir_parser.audio.aiff import AiffFile from hachoir_parser.audio.au import AuFile from hachoir_parser.audio.itunesdb import ITunesDBFile from hachoir_parser.audio.midi import MidiFile from hachoir_parser.audio.mpeg_audio import MpegAudioFile from hachoir_parser.audio.real_audio import RealAudioFile from hachoir_parser.audio.xm import XMModule from hachoir_parser.audio.s3m import S3MModule from hachoir_parser.audio.s3m import PTMModule from hachoir_parser.audio.mod import AmigaModule from hachoir_parser.audio.flac import FlacParser
546
Python
.py
11
48.545455
57
0.872659
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,616
id3.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/id3.py
""" ID3 metadata parser, supported versions: 1.O, 2.2, 2.3 and 2.4 Informations: http://www.id3.org/ Author: Victor Stinner """ from hachoir_core.field import (FieldSet, MatchError, ParserError, Enum, UInt8, UInt24, UInt32, CString, String, RawBytes, Bit, Bits, NullBytes, NullBits) from hachoir_core.text_handler import textHandler from hachoir_core.tools import humanDuration from hachoir_core.endian import NETWORK_ENDIAN class ID3v1(FieldSet): static_size = 128 * 8 GENRE_NAME = { 0: u"Blues", 1: u"Classic Rock", 2: u"Country", 3: u"Dance", 4: u"Disco", 5: u"Funk", 6: u"Grunge", 7: u"Hip-Hop", 8: u"Jazz", 9: u"Metal", 10: u"New Age", 11: u"Oldies", 12: u"Other", 13: u"Pop", 14: u"R&B", 15: u"Rap", 16: u"Reggae", 17: u"Rock", 18: u"Techno", 19: u"Industrial", 20: u"Alternative", 21: u"Ska", 22: u"Death Metal", 23: u"Pranks", 24: u"Soundtrack", 25: u"Euro-Techno", 26: u"Ambient", 27: u"Trip-Hop", 28: u"Vocal", 29: u"Jazz+Funk", 30: u"Fusion", 31: u"Trance", 32: u"Classical", 33: u"Instrumental", 34: u"Acid", 35: u"House", 36: u"Game", 37: u"Sound Clip", 38: u"Gospel", 39: u"Noise", 40: u"AlternRock", 41: u"Bass", 42: u"Soul", 43: u"Punk", 44: u"Space", 45: u"Meditative", 46: u"Instrumental Pop", 47: u"Instrumental Rock", 48: u"Ethnic", 49: u"Gothic", 50: u"Darkwave", 51: u"Techno-Industrial", 52: u"Electronic", 53: u"Pop-Folk", 54: u"Eurodance", 55: u"Dream", 56: u"Southern Rock", 57: u"Comedy", 58: u"Cult", 59: u"Gangsta", 60: u"Top 40", 61: u"Christian Rap", 62: u"Pop/Funk", 63: u"Jungle", 64: u"Native American", 65: u"Cabaret", 66: u"New Wave", 67: u"Psychadelic", 68: u"Rave", 69: u"Showtunes", 70: u"Trailer", 71: u"Lo-Fi", 72: u"Tribal", 73: u"Acid Punk", 74: u"Acid Jazz", 75: u"Polka", 76: u"Retro", 77: u"Musical", 78: u"Rock & Roll", 79: u"Hard Rock", # Following are winamp extentions 80: u"Folk", 81: u"Folk-Rock", 82: u"National Folk", 83: u"Swing", 84: u"Fast Fusion", 85: u"Bebob", 86: u"Latin", 87: u"Revival", 88: u"Celtic", 89: u"Bluegrass", 90: u"Avantgarde", 91: u"Gothic Rock", 92: u"Progressive Rock", 93: u"Psychedelic Rock", 94: u"Symphonic Rock", 95: u"Slow Rock", 96: u"Big Band", 97: u"Chorus", 98: u"Easy Listening", 99: u"Acoustic", 100: u"Humour", 101: u"Speech", 102: u"Chanson", 103: u"Opera", 104: u"Chamber Music", 105: u"Sonata", 106: u"Symphony", 107: u"Booty Bass", 108: u"Primus", 109: u"Porn Groove", 110: u"Satire", 111: u"Slow Jam", 112: u"Club", 113: u"Tango", 114: u"Samba", 115: u"Folklore", 116: u"Ballad", 117: u"Power Ballad", 118: u"Rhythmic Soul", 119: u"Freestyle", 120: u"Duet", 121: u"Punk Rock", 122: u"Drum Solo", 123: u"A capella", 124: u"Euro-House", 125: u"Dance Hall", 126: u"Goa", 127: u"Drum & Bass", 128: u"Club-House", 129: u"Hardcore", 130: u"Terror", 131: u"Indie", 132: u"Britpop", 133: u"Negerpunk", 134: u"Polsk Punk", 135: u"Beat", 136: u"Christian Gangsta Rap", 137: u"Heavy Metal", 138: u"Black Metal", 139: u"Crossover", 140: u"Contemporary Christian", 141: u"Christian Rock ", 142: u"Merengue", 143: u"Salsa", 144: u"Trash Metal", 145: u"Anime", 146: u"JPop", 147: u"Synthpop" } def createFields(self): yield String(self, "signature", 3, "IDv1 signature (\"TAG\")", charset="ASCII") if self["signature"].value != "TAG": raise MatchError("Stream doesn't look like ID3v1 (wrong signature)!") # TODO: Charset of below strings? yield String(self, "song", 30, "Song title", strip=" \0", charset="ISO-8859-1") yield String(self, "author", 30, "Author", strip=" \0", charset="ISO-8859-1") yield String(self, "album", 30, "Album title", strip=" \0", charset="ISO-8859-1") yield String(self, "year", 4, "Year", strip=" \0", charset="ISO-8859-1") # TODO: Write better algorithm to guess ID3v1 version version = self.getVersion() if version in ("v1.1", "v1.1b"): if version == "v1.1b": # ID3 v1.1b yield String(self, "comment", 29, "Comment", strip=" \0", charset="ISO-8859-1") yield UInt8(self, "track_nb", "Track number") else: # ID3 v1.1 yield String(self, "comment", 30, "Comment", strip=" \0", charset="ISO-8859-1") yield Enum(UInt8(self, "genre", "Genre"), self.GENRE_NAME) else: # ID3 v1.0 yield String(self, "comment", 31, "Comment", strip=" \0", charset="ISO-8859-1") def getVersion(self): addr = self.absolute_address + 126*8 bytes = self.stream.readBytes(addr, 2) # last byte (127) is not space? if bytes[1] != ' ': # byte 126 is nul? if bytes[0] == 0x00: return "v1.1" else: return "v1.1b" else: return "1.0" def createDescription(self): version = self.getVersion() return "ID 3%s: author=%s, song=%s" % ( version, self["author"].value, self["song"].value) def getCharset(field): try: key = field.value return ID3_StringCharset.charset_name[key] except KeyError: raise ParserError("ID3v2: Invalid charset (%s)." % key) class ID3_String(FieldSet): STRIP = " \0" def createFields(self): yield String(self, "text", self._size/8, "Text", charset="ISO-8859-1", strip=self.STRIP) class ID3_StringCharset(ID3_String): STRIP = " \0" charset_desc = { 0: "ISO-8859-1", 1: "UTF-16 with BOM", 2: "UTF-16 (big endian)", 3: "UTF-8" } charset_name = { 0: "ISO-8859-1", 1: "UTF-16", 2: "UTF-16-BE", 3: "UTF-8" } def createFields(self): yield Enum(UInt8(self, "charset"), self.charset_desc) size = (self.size - self.current_size)/8 if not size: return charset = getCharset(self["charset"]) yield String(self, "text", size, "Text", charset=charset, strip=self.STRIP) class ID3_Comment(ID3_StringCharset): def createFields(self): yield Enum(UInt8(self, "charset"), self.charset_desc) yield String(self, "lang", 3, "Language", charset="ASCII") charset = getCharset(self["charset"]) yield CString(self, "title", "Title", charset=charset, strip=self.STRIP) size = (self.size - self.current_size) // 8 if not size: return yield String(self, "text", size, "Text", charset=charset, strip=self.STRIP) class ID3_StringTitle(ID3_StringCharset): def createFields(self): yield Enum(UInt8(self, "charset"), self.charset_desc) if self.current_size == self.size: return charset = getCharset(self["charset"]) yield CString(self, "title", "Title", charset=charset, strip=self.STRIP) size = (self.size - self.current_size)/8 if not size: return yield String(self, "text", size, "Text", charset=charset, strip=self.STRIP) class ID3_Private(FieldSet): def createFields(self): size = self._size/8 # TODO: Strings charset? if self.stream.readBytes(self.absolute_address, 9) == "PeakValue": yield String(self, "text", 9, "Text") size -= 9 yield String(self, "content", size, "Content") class ID3_TrackLength(FieldSet): def createFields(self): yield NullBytes(self, "zero", 1) yield textHandler(String(self, "length", self._size/8 - 1, "Length in ms", charset="ASCII"), self.computeLength) def computeLength(self, field): try: ms = int(field.value) return humanDuration(ms) except: return field.value class ID3_Picture23(FieldSet): pict_type_name = { 0x00: "Other", 0x01: "32x32 pixels 'file icon' (PNG only)", 0x02: "Other file icon", 0x03: "Cover (front)", 0x04: "Cover (back)", 0x05: "Leaflet page", 0x06: "Media (e.g. lable side of CD)", 0x07: "Lead artist/lead performer/soloist", 0x08: "Artist/performer", 0x09: "Conductor", 0x0A: "Band/Orchestra", 0x0B: "Composer", 0x0C: "Lyricist/text writer", 0x0D: "Recording Location", 0x0E: "During recording", 0x0F: "During performance", 0x10: "Movie/video screen capture", 0x11: "A bright coloured fish", 0x12: "Illustration", 0x13: "Band/artist logotype", 0x14: "Publisher/Studio logotype" } def createFields(self): yield Enum(UInt8(self, "charset"), ID3_StringCharset.charset_desc) charset = getCharset(self["charset"]) yield String(self, "img_fmt", 3, charset="ASCII") yield Enum(UInt8(self, "pict_type"), self.pict_type_name) yield CString(self, "text", "Text", charset=charset, strip=" \0") size = (self._size - self._current_size) / 8 if size: yield RawBytes(self, "img_data", size) class ID3_Picture24(FieldSet): def createFields(self): yield Enum(UInt8(self, "charset"), ID3_StringCharset.charset_desc) charset = getCharset(self["charset"]) yield CString(self, "mime", "MIME type", charset=charset) yield Enum(UInt8(self, "pict_type"), ID3_Picture23.pict_type_name) yield CString(self, "description", charset=charset) size = (self._size - self._current_size) / 8 if size: yield RawBytes(self, "img_data", size) class ID3_Chunk(FieldSet): endian = NETWORK_ENDIAN tag22_name = { "TT2": "Track title", "TP1": "Artist", "TRK": "Track number", "COM": "Comment", "TCM": "Composer", "TAL": "Album", "TYE": "Year", "TEN": "Encoder", "TCO": "Content type", "PIC": "Picture" } tag23_name = { "COMM": "Comment", "PRIV": "Private", "TPE1": "Artist", "TCOP": "Copyright", "TALB": "Album", "TENC": "Encoder", "TYER": "Year", "TSSE": "Encoder settings", "TCOM": "Composer", "TRCK": "Track number", "PCNT": "Play counter", "TCON": "Content type", "TLEN": "Track length", "TIT2": "Track title", "WXXX": "User defined URL" } handler = { "COMM": ID3_Comment, "COM": ID3_Comment, "PIC": ID3_Picture23, "APIC": ID3_Picture24, "PRIV": ID3_Private, "TXXX": ID3_StringTitle, "WOAR": ID3_String, "WXXX": ID3_StringTitle, } def __init__(self, *args): FieldSet.__init__(self, *args) if 3 <= self["../ver_major"].value: self._size = (10 + self["size"].value) * 8 else: self._size = (self["size"].value + 6) * 8 def createFields(self): if 3 <= self["../ver_major"].value: # ID3 v2.3 and 2.4 yield Enum(String(self, "tag", 4, "Tag", charset="ASCII", strip="\0"), ID3_Chunk.tag23_name) if 4 <= self["../ver_major"].value: yield ID3_Size(self, "size") # ID3 v2.4 else: yield UInt32(self, "size") # ID3 v2.3 yield Bit(self, "tag_alter", "Tag alter preservation") yield Bit(self, "file_alter", "Tag alter preservation") yield Bit(self, "rd_only", "Read only?") yield NullBits(self, "padding[]", 5) yield Bit(self, "compressed", "Frame is compressed?") yield Bit(self, "encrypted", "Frame is encrypted?") yield Bit(self, "group", "Grouping identity") yield NullBits(self, "padding[]", 5) size = self["size"].value is_compressed = self["compressed"].value else: # ID3 v2.2 yield Enum(String(self, "tag", 3, "Tag", charset="ASCII", strip="\0"), ID3_Chunk.tag22_name) yield UInt24(self, "size") size = self["size"].value - self.current_size/8 + 6 is_compressed = False if size: cls = None if not(is_compressed): tag = self["tag"].value if tag in ID3_Chunk.handler: cls = ID3_Chunk.handler[tag] elif tag[0] == "T": cls = ID3_StringCharset if cls: yield cls(self, "content", "Content", size=size*8) else: yield RawBytes(self, "content", size, "Raw data content") def createDescription(self): if self["size"].value != 0: return "ID3 Chunk: %s" % self["tag"].display else: return "ID3 Chunk: (terminator)" class ID3_Size(Bits): static_size = 32 def __init__(self, parent, name, description=None): Bits.__init__(self, parent, name, 32, description) def createValue(self): data = self.parent.stream.readBytes(self.absolute_address, 4) # TODO: Check that bit #7 of each byte is nul: not(ord(data[i]) & 127) return reduce(lambda x, y: x*128 + y, (ord(item) for item in data )) class ID3v2(FieldSet): endian = NETWORK_ENDIAN VALID_MAJOR_VERSIONS = (2, 3, 4) def __init__(self, parent, name, size=None): FieldSet.__init__(self, parent, name, size=size) if not self._size: self._size = (self["size"].value + 10) * 8 def createDescription(self): return "ID3 v2.%s.%s" % \ (self["ver_major"].value, self["ver_minor"].value) def createFields(self): # Signature + version yield String(self, "header", 3, "Header (ID3)", charset="ASCII") yield UInt8(self, "ver_major", "Version (major)") yield UInt8(self, "ver_minor", "Version (minor)") # Check format if self["header"].value != "ID3": raise MatchError("Signature error, should be \"ID3\".") if self["ver_major"].value not in self.VALID_MAJOR_VERSIONS \ or self["ver_minor"].value != 0: raise MatchError( "Unknown ID3 metadata version (2.%u.%u)" % (self["ver_major"].value, self["ver_minor"].value)) # Flags yield Bit(self, "unsync", "Unsynchronisation is used?") yield Bit(self, "ext", "Extended header is used?") yield Bit(self, "exp", "Experimental indicator") yield NullBits(self, "padding[]", 5) # Size yield ID3_Size(self, "size") # All tags while self.current_size < self._size: field = ID3_Chunk(self, "field[]") yield field if field["size"].value == 0: break # Search first byte of the MPEG file padding = self.seekBit(self._size) if padding: yield padding
16,092
Python
.py
454
26.04185
104
0.534427
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,617
midi.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/midi.pyc
Ñò Î ÈMc @sqdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z ddklZddklZlZddklZlZddklZdZd efd „ƒYZd „Zd „Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"defd„ƒYZ#defd„ƒYZ$defd„ƒYZ%defd„ƒYZ&dS( sÌ Musical Instrument Digital Interface (MIDI) audio file parser. Documentation: - Standard MIDI File Format, Dustin Caldwell (downloaded on wotsit.org) Author: Victor Stinner Creation: 27 december 2006 iÿÿÿÿ(tParser( tFieldSettBitst ParserErrortStringtUInt32tUInt24tUInt16tUInt8tEnumtRawBytes(t BIG_ENDIAN(t textHandlert hexadecimal(t createDictthumanDurationNanosec(t NOTE_NAMEi itIntegercBseZdd„ZRS(csÉti|||d|ƒ|i}|i}d‰xtow|i|d|iƒ}ˆd>|d@‰|d@pPn|d7}|id7_d|ijotdƒ‚q4q4W‡fd†|_ dS( Niiiii€i s"Integer size is bigger than 32-bitcsˆS((((tvalue(sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt<lambda>$s( Rt__init__tstreamtabsolute_addresstTruetreadBitstendiant_sizeRt createValue(tselftparenttnamet descriptionRtaddrtbits((RsC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRs    N(t__name__t __module__tNoneR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRsccs,tt|ddƒtƒVt|dƒVdS(Ntnotes Note numbertvelocity(R RR(tparser((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parseNote&sccs&t|ddƒVt|ddƒVdS(NtcontrolsController numberRs New value(R(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parseControl*sccst|ddƒVdS(NtprogramsNew program number(R(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parsePatch.sccst|ddƒVdS(NtchannelsChannel number(R(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parseChannel1sccs&t|ddƒVt|ddƒVdS(Ntbottoms(least sig) 7 bits of valuettops(most sig) 7 bits of value(R(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parsePitch4sccst|d|ƒVdS(Nttext(R(R'tsize((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parseText8scCst|idƒS(Niè(RR(tfield((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt formatTempo;sccstt|ddƒtƒVdS(Ntmicrosec_quartersMicroseconds per quarter note(R RR6(R'R3((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt parseTempo>sccsHt|ddƒVt|ddƒVt|ddƒVt|ddƒVdS( Nt numeratorsNumerator of time signaturet denominators6denominator of time signature 2=quarter 3=eighth, etc.tnb_ticks"Number of ticks in metronome clickt nb_32nd_notes(Number of 32nd notes to the quarter note(R(R'R3((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pytparseTimeSignatureAstCommandcBs¾eZhZx¼edƒD]®Zdeefede<deefede<deefede<deefede<d eefed e<d eefed e<d ee fede<qWe edƒZ e edƒZ dZ dZh d,d6defd6defd6defd6defd6defd6defd6defd6d-d 6d!efd"6d#efd$6d.d&6d/d(6Ze edƒZe edƒZd)„Zd*„ZRS(0isNote off (channel %u)i€sNote on (channel %u)i�sKey after-touch (channel %u)i sControl change (channel %u)i°s#Program (patch) change (channel %u)iÀs Channel after-touch (channel %u)iÐsPitch wheel change (channel %u)iàiiis Sets the track's sequence numbers Text eventsCopyright infoisSequence or Track namesTrack instrument nameitLyricitMarkeris Cue pointisEnd of the tracki/s Set tempoiQsTime SignatureiXs Key signatureiYsSequencer specific informationiccsbt|ddƒVttt|dƒtƒ|iƒV|di}|djo¼ttt|dƒtƒ|iƒVt|dƒV|di}|os|di}||ijo|i|}nd}|o#x1|||ƒD] }|VqÞWqt |d|ƒVq^nU||i jot d|di ƒ‚n|i |}x||ƒD] }|VqOWdS( NttimesDelta time in tickstcommandiÿt meta_commandtdata_lentdatasUnknown command: %s(RR R RR t COMMAND_DESCRtMETA_COMMAND_DESCtMETA_COMMAND_PARSERR$R tCOMMAND_PARSERRtdisplay(RRBR3R'R5((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt createFieldshs.#  #     cCs(d|jo |diS|diSdS(NRCRB(RJ(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pytcreateDescription‚s  N(s Sets the track's sequence numberN(sEnd of the trackN(s Key signatureN(sSequencer specific informationN(R"R#tCOMMANDtxrangeR-R(R*R,R.R1RRFRItMETA_COMMAND_TEXTtMETA_COMMAND_NAMER$R4R8R=t META_COMMANDRGRHRKRL(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyR>Gs@            tTrackcBs#eZd„Zd„Zd„ZRS(cGs,ti||Œd|did|_dS(NiR3(RRRR(Rtargs((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyR‰sccs€t|dddddƒVt|dƒVto$xJ|ipt|dƒVq2Wn*|di}|ot|d|ƒVndS( NtmarkerisTrack marker (MTrk)tcharsettASCIIR3s command[]traw(RRRteofR>RR (RR3((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRK�s  cCsa|d}d|joB|dititifjo"d|jo|diidƒSdSdS(Ns command[0]RCR2s t(RR>RORPtstrip(RRB((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRL˜s     (R"R#RRKRL(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRRˆs  tHeadercBs;eZd Zhdd6dd6dd6Zd„Zd „ZRS( i is Single trackisMultiple tracks, synchronousisMultiple tracks, asynchronousiccsKt|dƒVtt|dƒ|iƒVt|dƒVt|ddƒVdS(NR3t file_formattnb_trackt delta_times!Delta-time ticks per quarter note(RR Rt FILE_FORMAT(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRK©scCsd|di|difS(Ns %s; %s tracksR\R](RJR(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRL¯siP(R"R#t static_sizeR_RKRL(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyR[¡s  tMidiFilecBs~eZdZhdd6dd6ddgd6dd6ed ffd 6d d 6d d6ZeZd„Zd„Zd„Zd„Z RS(tMThdtmiditidtaudiotcategorytmidtfile_extu audio/mimetmimeitmagici@tmin_sizes MIDI audioRcCsA|iiddƒ|ijodS|didjodStS(NiisInvalid signatures header/sizeisInvalid header size(Rt readBytestMAGICRR(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pytvalidateÀs ccsLt|dddddƒVt|dƒVx|ipt|dƒVq+WdS(Nt signatureisMIDI signature (MThd)RURVtheaderstrack[](RR[RXRR(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRKÇs  cCsd|diS(NsMIDI audio: %sRp(R(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRLÍscCsX|did}|d|i}|iid|tdƒ}|dj o |dSdS(Ns/header/nb_trackis track[%u]sÿ/iii(RRRt searchBytest MAX_FILESIZER$(Rtcounttstarttend((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pytcreateContentSizeÐs   (u audio/mime( R"R#Rmt PARSER_TAGSR RRnRKRLRv(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyRa³s     Ni(i ('t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R thachoir_core.endianR thachoir_core.text_handlerR R thachoir_core.toolsRRthachoir_parser.common.trackerRRrRR(R*R,R.R1R4R6R8R=R>RRR[Ra(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/midi.pyt<module> s*F         A
11,164
Python
.py
49
226.755102
917
0.472017
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,618
au.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/au.py
""" AU audio file parser Author: Victor Stinner Creation: 12 july 2006 """ from hachoir_parser import Parser from hachoir_core.field import UInt32, Enum, String, RawBytes from hachoir_core.endian import BIG_ENDIAN from hachoir_core.text_handler import displayHandler, filesizeHandler from hachoir_core.tools import createDict, humanFrequency class AuFile(Parser): PARSER_TAGS = { "id": "sun_next_snd", "category": "audio", "file_ext": ("au", "snd"), "mime": (u"audio/basic",), "min_size": 24*8, "magic": ((".snd", 0),), "description": "Sun/NeXT audio" } endian = BIG_ENDIAN CODEC_INFO = { 1: (8, u"8-bit ISDN u-law"), 2: (8, u"8-bit linear PCM"), 3: (16, u"16-bit linear PCM"), 4: (24, u"24-bit linear PCM"), 5: (32, u"32-bit linear PCM"), 6: (32, u"32-bit IEEE floating point"), 7: (64, u"64-bit IEEE floating point"), 8: (None, u"Fragmented sample data"), 9: (None, u"DSP program"), 10: (8, u"8-bit fixed point"), 11: (16, u"16-bit fixed point"), 12: (24, u"24-bit fixed point"), 13: (32, u"32-bit fixed point"), 18: (16, u"16-bit linear with emphasis"), 19: (16, u"16-bit linear compressed"), 20: (16, u"16-bit linear with emphasis and compression"), 21: (None, u"Music kit DSP commands"), 23: (None, u"4-bit ISDN u-law compressed (CCITT G.721 ADPCM)"), 24: (None, u"ITU-T G.722 ADPCM"), 25: (None, u"ITU-T G.723 3-bit ADPCM"), 26: (None, u"ITU-T G.723 5-bit ADPCM"), 27: (8, u"8-bit ISDN A-law"), } # Create bit rate and codec name dictionnaries BITS_PER_SAMPLE = createDict(CODEC_INFO, 0) CODEC_NAME = createDict(CODEC_INFO, 1) VALID_NB_CHANNEL = set((1,2)) # FIXME: 4, 5, 7, 8 channels are supported? def validate(self): if self.stream.readBytes(0, 4) != ".snd": return "Wrong file signature" if self["channels"].value not in self.VALID_NB_CHANNEL: return "Invalid number of channel" return True def getBitsPerSample(self): """ Get bit rate (number of bit per sample per channel), may returns None if you unable to compute it. """ return self.BITS_PER_SAMPLE.get(self["codec"].value) def createFields(self): yield String(self, "signature", 4, 'Format signature (".snd")', charset="ASCII") yield UInt32(self, "data_ofs", "Data offset") yield filesizeHandler(UInt32(self, "data_size", "Data size")) yield Enum(UInt32(self, "codec", "Audio codec"), self.CODEC_NAME) yield displayHandler(UInt32(self, "sample_rate", "Number of samples/second"), humanFrequency) yield UInt32(self, "channels", "Number of interleaved channels") size = self["data_ofs"].value - self.current_size // 8 if 0 < size: yield String(self, "info", size, "Information", strip=" \0", charset="ISO-8859-1") size = min(self["data_size"].value, (self.size - self.current_size) // 8) yield RawBytes(self, "audio_data", size, "Audio data") def createContentSize(self): return (self["data_ofs"].value + self["data_size"].value) * 8
3,307
Python
.py
75
36.8
101
0.601118
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,619
itunesdb.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/itunesdb.pyc
—Ú Œ »Mc@s;dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z ddklZddklZddklZlZhdd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6ZdDefdEÑÉYZdFefdGÑÉYZdHefdIÑÉYZdJefdKÑÉYZdLefdMÑÉYZdNefdOÑÉYZdPefdQÑÉYZdRefdSÑÉYZdTefdUÑÉYZdVS(Ws} iPod iTunesDB parser. Documentation: - http://ipodlinux.org/ITunesDB Author: Romain HERAULT Creation date: 19 august 2006 iˇˇˇˇ(tParser( tFieldSettUInt8tUInt16tUInt32tUInt64tTimestampMac32tStringtFloat32t NullBytestEnum(t LITTLE_ENDIAN(t humanDuration(tdisplayHandlertfilesizeHandlers"playlist order (manual sort order)is???it songtitleitalbumitartistitbitrateitgenreitkindis date modifiedi s track numberi tsizei ttimei tyeari s sample rateitcommentis date addedit equalizeritcomposeriis play countis last playedis disc numberis my ratingis release dateitBPMitgroupingitcategoryit descriptionitshowitseasonisepisode numberit DataObjectcBsÍeZhdd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6Zhdd6d.d6d/d 6d0d 6d1d6Zd2ÑZd3ÑZRS(4tTitleitLocationitAlbumitArtistitGenreitFiletypeis EQ SettingitCommentitCategoryi tComposeri tGroupingi sDescription textisPodcast Enclosure URLisPodcast RSS URLis Chapter dataitSubtitleisShow (for TV Shows only)itEpisodeis TV NetworkisSmart Playlist Datai2sSmart Playlist Rulesi3sLibrary Playlist Indexi4s Column infoids(Album, then Disk/Tracknumber, then Titles5Artist, then Album, then Disc/Tracknumber, then TitlesAGenre, then Artist, then Album, then Disc/Tracknumber, then TitlesComposer, then TitlecOs+ti|||é|did|_dS(Nt entry_lengthi(Rt__init__tvaluet_size(tselftargstkw((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR/Xsccsït|dddddÉVt|ddÉVt|dd ÉVtt|d d É|iÉV|d id jot|d ÉVt|d ÉVt|d dÉVt|ddÉVt|d ÉVt|d ÉVt|d|didddÉVnÅ|d idjoLt|d ÉVt|d ÉVt|d|id|didddÉVn!|d idjo„t|d dÉVt|d dÉVtt|ddÉ|iÉVt|ddÉV|did}|di|}|i|dÉ}|o |Vnxut|diÉD]3}t|dt |Éd d!t |Éd"ÉVqWn*|i|didÉ}|o |Vn|i |id#É}|o |VndS($Nt header_idis"Data Object Header Markup ("mhod")tcharsets ISO-8859-1t header_lengths Header LengthR.s Entry Lengthttypeis unknown[]tpositiontPositiontlengthsString Length in byteststrings String Datas UTF-16-LEiisUTF-8i4tunk1tunk2tsort_index_typesSort Index Typet entry_counts Entry Countsheader paddingsindex[t]s Index of the snth mhits entry padding( RRR t type_nameR0R1tmhod52_sort_index_type_nametseekBytetxrangetstrtseekBit(R2t indexes_sizetpadding_offsettpaddingti((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyt createFields\sF%0 5 (t__name__t __module__RBRCR/RL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR!5s@   t TrackItemcBsáeZhdd6dd6Zhdd6dd6Zh dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6ZdÑZdÑZRS(sAAC or CBR MP3isVBR MP3itAACtMP3s Audio/VideotAudiotVideoitPodcastis Video Podcastit Audiobookis Music Videoi sTV Showi@sTV Show (Music lists)i`cOs+ti|||é|did|_dS(NR.i(RR/R0R1(R2R3R4((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR/ïsccs8t|dddddÉVt|ddÉVt|dd ÉVt|d d ÉVt|d d ÉVt|ddÉVt|dddÉVtt|ddÉ|iÉVtt|ddÉ|iÉVt|ddÉVt|ddÉVt|ddÉVtt|ddÉÉVtt|ddÉt ÉVt|d d!ÉVt|d"d#ÉVt|d$d%ÉVt|d&d'ÉVt|d(d)ÉVt|d*d*ÉVt|d+d,ÉVt|d-d.ÉVt|d/d0ÉVt|d1d2ÉVt|d3d4ÉVt|d5d6ÉVt|d7d8ÉVt|d9d:ÉVt|d;d<ÉVt|d=d>ÉVt|d?d@ÉVt |dAdBÉVt|dCdDÉVt|dEdFÉVt |dGdHÉVt |dIdJÉVt |dKÉVt|dLdMÉVt|dKÉVt |dNdOÉVt|dPdQÉVt|dKÉVt|dKÉVt|dKÉVt|dKÉVt|dKÉVt|dRdSÉVt|dTdUÉVt|dVdWÉVt|dXdYÉVt |dZd[ÉVt|d\d]ÉVt|d^d_ÉVt|d`daÉVt|dKÉVt|dKÉVt|dKÉVt|dbdcÉVt|dKÉVt|dKÉVt|dKÉVt|dKÉVtt|dddeÉ|i ÉVt|dfdgÉVt|dhdiÉVt|dKÉVt|dKÉVt|dKÉVt|dKÉVt|dKÉVt|dKÉV|i|didjÉ}|o |Vnx)t|d iÉD]}t|dkÉVq˜W|i|idlÉ}|o |VndS(mNR5is!Track Item Header Markup ("mhit")R6s ISO-8859-1R7s Header LengthR.s Entry Lengtht string_numbersNumber of Stringst unique_ids Unique IDt visible_tags Visible Tagt file_types File Typetx1_typesExtended Type 1tx2_typesExtended type 2tcompilation_flagsCompilation FlagtratingtRatingt added_datesDate when the item was addedRsTrack size in bytesR;sTrack length in millisecondst track_numbersNumber of this trackt total_tracksTotal number of tracksRsYear of the trackRtBitratet samplerates Sample Ratetvolumet start_times!Start playing at, in millisecondst stop_times!Stop playing at, in millisecondst soundchecksSoundCheck preampt playcount_1sPlay count of the trackt playcount_2s2Play count of the track (identical to playcount_1)tlast_played_timesTime the song was last playedt disc_numbersdisc number in multi disc setst total_discss%Total number of discs in the disc settuseridsUser ID in the DRM schemet last_modifieds*Time of the last modification of the trackt bookmark_timesBookmark time for AudioBooktdbids?Unique DataBase ID for the song (identical in mhit and in mhii)tcheckedssong is checkedtapplication_ratingsLast Rating before changeRsBPM of the trackt artwork_countsnumber of artworks fo this items unknown[]t artwork_sizesTotal size of artworks in bytest sample_rate_2sSample Rate express in floatt released_dates,Date of release in Music Store or in Podcastt has_artworks+0x01 for track with artwork, 0x02 otherwisetskip_wen_shufflingsSkip that track when shufflingtremember_playback_positionsRemember playback positiontflag4sFlag 4tdbid2s4Unique DataBase ID for the song (identical as above)t lyrics_flags Lyrics Flagtmovie_file_flagsMovie File Flagt played_marksTrack has been playedt sample_counts:Number of samples in the song (only for WAV and AAC files)t media_typesMedia Type for video iPodt season_numbers Season Numbertepisode_numbersEpisode Numbersheader paddingsdata[]s entry padding(RRR Rt x1_type_namet x2_type_nameRRR R RRRtmedia_type_nameRDR0RER!RGR1(R2RJRK((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRLôs† (RMRNRÉRÑRÖR/RL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyROÅs$    t TrackListcBseZdÑZRS(ccsït|dddddÉVt|ddÉVt|dd ÉV|i|did É}|o |Vnx)t|diÉD]}t|d ÉVqyWdS( NR5is!Track List Header Markup ("mhlt")R6s ISO-8859-1R7s Header LengthR`sNumber of Trackssheader paddingstrack[](RRRDR0RERO(R2RJRK((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRLÌs (RMRNRL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRÜÏst PlaylistItemcBseZdÑZdÑZRS(cOs+ti|||é|did|_dS(NR.i(RR/R0R1(R2R3R4((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR/˙sccs˚t|dddddÉVt|ddÉVt|dd ÉVt|d d ÉVt|d d ÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉV|i|didÉ}|o |Vnx)t|d iÉD]}t|dÉVqflWdS(NR5is$Playlist Item Header Markup ("mhip")R6s ISO-8859-1R7s Header LengthR.s Entry Lengthtdata_object_child_countsNumber of Child Data Objectstpodcast_grouping_flagsPodcast Grouping Flagtgroup_idsGroup IDttrack_idsTrack IDt timestampsSong Timestamptpodcast_grouping_refsPodcast Grouping Referencesheader paddingsmhod[](RRRRDR0RER!(R2RJRK((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRL˛s (RMRNR/RL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRá˘s tPlaylistcBs!eZhdd6dd6Zhdd6dd6Zhdd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6dd)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6ZdBÑZdCÑZRS(DsRegular playlistisMaster playlistisNormal Playlist ListsPodcast Playlist ListsManual Sort Orders???is Song TitleiR$iR%iRbiR&itKindis Date Modifiedi s Track Numberi tSizei tTimei tYeari s Sample RateiR(is Date Addedit EqualizeriR*iis Play Countis Last Playedis Disc Numberis My Ratingis Release DateiRiR+iR)it DescriptionitShowitSeasonisEpisode NumbericOs+ti|||é|did|_dS(NR.i(RR/R0R1(R2R3R4((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR/=sccs±t|dddddÉVt|ddÉVt|dd ÉVt|d d ÉVt|d d ÉVtt|ddÉ|iÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVtt|ddÉ|iÉVtt|ddÉ|i ÉV|i |di dÉ}|o |Vnx)t |d i ÉD]}t |dÉVqiWx)t |d i ÉD]}t|d ÉVqïWdS(!NR5is$Playlist List Header Markup ("mhyp")R6s ISO-8859-1R7s Header LengthR.s Entry LengthRàsNumber of Child Data Objectstplaylist_countsNumber of Playlist ItemsR8sNormal or master playlist?tXXX1tXXX2tXXX3t creation_dates"Date when the playlist was createdt playlistidsPersistent Playlist IDtunk3tstring_mhod_counts(Number of string MHODs for this playlistt is_podcastsPlaylist or Podcast List?t sort_ordersPlaylist Sort Orders entry paddingsmhod[]splaylist_item[](RRR Rtis_master_pl_nameRRRtis_podcast_nametlist_sort_order_nameRDR0RER!Rá(R2RJRK((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRLAs0 (RMRNR°R¢R£R/RL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRésP    t PlaylistListcBseZdÑZRS(ccsït|dddddÉVt|ddÉVt|dd ÉV|i|did É}|o |Vnx)t|diÉD]}t|d ÉVqyWdS( NR5is$Playlist List Header Markup ("mhlp")R6s ISO-8859-1R7s Header Lengthtplaylist_numbersNumber of Playlistssheader paddings playlist[](RRRDR0RERé(R2RJRK((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRL_s (RMRNRL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR§^stDataSetcBs5eZhdd6dd6dd6ZdÑZdÑZRS(s Track Listis Play Listis Podcast ListicOs+ti|||é|did|_dS(NR.i(RR/R0R1(R2R3R4((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR/qsccst|dddddÉVt|ddÉVt|dd ÉVtt|d d É|iÉV|i|did É}|o |Vn|d id jot|d ÉVn|d idjot|dÉVn|d idjot|dÉVn|i|i dÉ}|o |VndS(NR5isDataSet Header Markup ("mhsd")R6s ISO-8859-1R7s Header LengthR.s Entry LengthR8t header_rawis tracklist[]isplaylist_list[]ispodcast_list[]s entry padding( RRR RBRDR0RÜR§RGR1(R2RJ((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRLus  (RMRNRBR/RL(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR¶ks   tDataBasecBseZdÑZRS(cOs+ti|||é|did|_dS(NR.i(RR/R0R1(R2R3R4((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR/às(RMRNR/(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR®ást ITunesDBFilecBsReZhdd6dd6dd6dd 6d d 6ZeZd ÑZd ÑZdÑZRS(titunesdbtidtaudioRi,itmin_sizetmhbditmagicsiPod iTunesDB fileRcCs|iiddÉdjS(NiiRÆ(tstreamt readBytes(R2((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pytvalidateôsccs/t|dddddÉVt|ddÉVt|dd ÉVt|d ÉVt|d d ÉVt|d dÉVt|ddÉVt|d ÉVt|ddÉV|di|id}|djot|d|ÉVnx)t|d iÉD]}t|dÉVqÍW|i|didÉ}|o |VndS(NR5isDataBase Header Markup ("mhbd")R6s ISO-8859-1R7s Header LengthR.s Entry Lengths unknown[]tversion_numbersVersion Numbert child_numbersNumber of ChildrenR´sID for this databaset initial_dbids Initial DBIDiiRJs dataset[]s entry padding( RRRR0t current_sizeR RER¶RD(R2RRKRJ((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyRLús$ cCs|didS(NR.i(R0(R2((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pytcreateContentSizeØsi`(smhbdi((smhbdi(RMRNt PARSER_TAGSR tendianR≤RLR∑(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyR©és   N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R thachoir_core.endianR thachoir_core.toolsR thachoir_core.text_handlerR Rt list_orderR!RORÜRáRéR§R¶R®R©(((sG/pentest/enumeration/google/metagoofil/hachoir_parser/audio/itunesdb.pyt<module> s\F Lk N 
18,731
Python
.py
88
211.829545
1,364
0.488896
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,620
mod.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/mod.py
""" Parser of FastTrackerII Extended Module (XM) version 1.4 Documents: - Modplug source code (file modplug/soundlib/Load_mod.cpp) http://sourceforge.net/projects/modplug - Dumb source code (files include/dumb.h and src/it/readmod.c http://dumb.sf.net/ - Documents on "MOD" format on Wotsit http://www.wotsit.org Compressed formats (i.e. starting with "PP20" or having "PACK" as type are not handled. Also NoiseTracker's NST modules aren't handled, although it might be possible: no file format and 15 samples Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 18th February 2007 """ from math import log10 from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Bits, UInt16, UInt8, RawBytes, String, GenericVector) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_core.text_handler import textHandler from hachoir_parser.common.tracker import NOTE_NAME # Old NoiseTracker 15-samples modules can have anything here. MODULE_TYPE = { "M.K.": ("Noise/Pro-Tracker", 4), "M!K!": ("Noise/Pro-Tracker", 4), "M&K&": ("Noise/Pro-Tracker", 4), "RASP": ("StarTrekker", 4), "FLT4": ("StarTrekker", 4), "FLT8": ("StarTrekker", 8), "6CHN": ("FastTracker", 6), "8CHN": ("FastTracker", 8), "CD81": ("Octalyser", 8), "OCTA": ("Octalyser", 8), "FA04": ("Digital Tracker", 4), "FA06": ("Digital Tracker", 6), "FA08": ("Digital Tracker", 8), } def getFineTune(val): return ("0", "1", "2", "3", "4", "5", "6", "7", "8", "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1")[val.value] def getVolume(val): return "%.1f dB" % (20.0*log10(val.value/64.0)) class SampleInfo(FieldSet): static_size = 30*8 def createFields(self): yield String(self, "name", 22, strip='\0') yield UInt16(self, "sample_count") yield textHandler(UInt8(self, "fine_tune"), getFineTune) yield textHandler(UInt8(self, "volume"), getVolume) yield UInt16(self, "loop_start", "Loop start offset in samples") yield UInt16(self, "loop_len", "Loop length in samples") def createValue(self): return self["name"].value class Header(FieldSet): static_size = 1084*8 def createFields(self): yield String(self, "name", 20, strip='\0') yield GenericVector(self, "samples", 31, SampleInfo, "info") yield UInt8(self, "length") yield UInt8(self, "played_patterns_count") yield GenericVector(self, "patterns", 128, UInt8, "position") yield String(self, "type", 4) def getNumChannels(self): return MODULE_TYPE[self["type"].value][1] class Note(FieldSet): static_size = 8*4 def createFields(self): yield Bits(self, 4, "note_hi_nibble") yield Bits(self, 12, "period") yield Bits(self, 4, "note_low_nibble") yield Bits(self, 4, "effect") yield UInt8(self, "parameter") class Row(FieldSet): def __init__(self, parent, name, channels, desc=None): FieldSet.__init__(self, parent, name, description=desc) self.channels = channels self._size = 8*self.channels*4 def createFields(self): for index in xrange(self.channels): yield Note(self, "note[]") class Pattern(FieldSet): def __init__(self, parent, name, channels, desc=None): FieldSet.__init__(self, parent, name, description=desc) self.channels = channels self._size = 64*8*self.channels*4 def createFields(self): for index in xrange(64): yield Row(self, "row[]", self.channels) class AmigaModule(Parser): PARSER_TAGS = { "id": "mod", "category": "audio", "file_ext": ("mod", "nst", "wow", "oct", "sd0" ), "mime": (u'audio/mod', u'audio/x-mod', u'audio/mod', u'audio/x-mod'), "min_size": 1084*8, "description": "Uncompressed amiga module" } endian = BIG_ENDIAN def validate(self): t = self.stream.readBytes(1080*8, 4) if t not in MODULE_TYPE: return "Invalid module type '%s'" % t self.createValue = lambda t: "%s module, %u channels" % MODULE_TYPE[t] return True def createFields(self): header = Header(self, "header") yield header channels = header.getNumChannels() # Number of patterns patterns = 0 for index in xrange(128): patterns = max(patterns, header["patterns/position[%u]" % index].value) patterns += 1 # Yield patterns for index in xrange(patterns): yield Pattern(self, "pattern[]", channels) # Yield samples for index in xrange(31): count = header["samples/info[%u]/sample_count" % index].value if count: self.info("Yielding sample %u: %u samples" % (index, count)) yield RawBytes(self, "sample_data[]", 2*count, \ "Sample %u" % index)
5,015
Python
.py
126
32.960317
78
0.619527
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,621
xm.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/xm.py
""" Parser of FastTrackerII Extended Module (XM) version 1.4 Documents: - Modplug source code (file modplug/soundlib/Load_xm.cpp) http://sourceforge.net/projects/modplug - Dumb source code (files include/dumb.h and src/it/readxm.c http://dumb.sf.net/ - Documents of "XM" format on Wotsit http://www.wotsit.org Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 8th February 2007 """ from hachoir_parser import Parser from hachoir_core.field import (StaticFieldSet, FieldSet, Bit, RawBits, Bits, UInt32, UInt16, UInt8, Int8, Enum, RawBytes, String, GenericVector) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_core.text_handler import textHandler, filesizeHandler, hexadecimal from hachoir_parser.audio.modplug import ParseModplugMetadata from hachoir_parser.common.tracker import NOTE_NAME def parseSigned(val): return "%i" % (val.value-128) # From dumb SEMITONE_BASE = 1.059463094359295309843105314939748495817 PITCH_BASE = 1.000225659305069791926712241547647863626 SAMPLE_LOOP_MODE = ("No loop", "Forward loop", "Ping-pong loop", "Undef") class SampleType(FieldSet): static_size = 8 def createFields(self): yield Bits(self, "unused[]", 4) yield Bit(self, "16bits") yield Bits(self, "unused[]", 1) yield Enum(Bits(self, "loop_mode", 2), SAMPLE_LOOP_MODE) class SampleHeader(FieldSet): static_size = 40*8 def createFields(self): yield UInt32(self, "length") yield UInt32(self, "loop_start") yield UInt32(self, "loop_end") yield UInt8(self, "volume") yield Int8(self, "fine_tune") yield SampleType(self, "type") yield UInt8(self, "panning") yield Int8(self, "relative_note") yield UInt8(self, "reserved") yield String(self, "name", 22, charset="ASCII", strip=' \0') def createValue(self): bytes = 1+self["type/16bits"].value C5_speed = int(16726.0*pow(SEMITONE_BASE, self["relative_note"].value) *pow(PITCH_BASE, self["fine_tune"].value*2)) return "%s, %ubits, %u samples, %uHz" % \ (self["name"].display, 8*bytes, self["length"].value/bytes, C5_speed) class StuffType(StaticFieldSet): format = ( (Bits, "unused", 5), (Bit, "loop"), (Bit, "sustain"), (Bit, "on") ) class InstrumentSecondHeader(FieldSet): static_size = 234*8 def createFields(self): yield UInt32(self, "sample_header_size") yield GenericVector(self, "notes", 96, UInt8, "sample") yield GenericVector(self, "volume_envelope", 24, UInt16, "point") yield GenericVector(self, "panning_envelope", 24, UInt16, "point") yield UInt8(self, "volume_points", r"Number of volume points") yield UInt8(self, "panning_points", r"Number of panning points") yield UInt8(self, "volume_sustain_point") yield UInt8(self, "volume_loop_start_point") yield UInt8(self, "volume_loop_end_point") yield UInt8(self, "panning_sustain_point") yield UInt8(self, "panning_loop_start_point") yield UInt8(self, "panning_loop_end_point") yield StuffType(self, "volume_type") yield StuffType(self, "panning_type") yield UInt8(self, "vibrato_type") yield UInt8(self, "vibrato_sweep") yield UInt8(self, "vibrato_depth") yield UInt8(self, "vibrato_rate") yield UInt16(self, "volume_fadeout") yield GenericVector(self, "reserved", 11, UInt16, "word") def createInstrumentContentSize(s, addr): start = addr samples = s.stream.readBits(addr+27*8, 16, LITTLE_ENDIAN) # Seek to end of header (1st + 2nd part) addr += 8*s.stream.readBits(addr, 32, LITTLE_ENDIAN) sample_size = 0 if samples: for index in xrange(samples): # Read the sample size from the header sample_size += s.stream.readBits(addr, 32, LITTLE_ENDIAN) # Seek to next sample header addr += SampleHeader.static_size return addr - start + 8*sample_size class Instrument(FieldSet): def __init__(self, parent, name): FieldSet.__init__(self, parent, name) self._size = createInstrumentContentSize(self, self.absolute_address) self.info(self.createDescription()) # Seems to fix things... def fixInstrumentHeader(self): size = self["size"].value - self.current_size//8 if size: yield RawBytes(self, "unknown_data", size) def createFields(self): yield UInt32(self, "size") yield String(self, "name", 22, charset="ASCII", strip=" \0") # Doc says type is always 0, but I've found values of 24 and 96 for # the _same_ song here, just different download sources for the file yield UInt8(self, "type") yield UInt16(self, "samples") num = self["samples"].value self.info(self.createDescription()) if num: yield InstrumentSecondHeader(self, "second_header") for field in self.fixInstrumentHeader(): yield field # This part probably wrong sample_size = [ ] for index in xrange(num): sample = SampleHeader(self, "sample_header[]") yield sample sample_size.append(sample["length"].value) for size in sample_size: if size: yield RawBytes(self, "sample_data[]", size, "Deltas") else: for field in self.fixInstrumentHeader(): yield field def createDescription(self): return "Instrument '%s': %i samples, header %i bytes" % \ (self["name"].value, self["samples"].value, self["size"].value) VOLUME_NAME = ( "Volume slide down", "Volume slide up", "Fine volume slide down", "Fine volume slide up", "Set vibrato speed", "Vibrato", "Set panning", "Panning slide left", "Panning slide right", "Tone porta", "Unhandled") def parseVolume(val): val = val.value if 0x10<=val<=0x50: return "Volume %i" % val-16 else: return VOLUME_NAME[val/16 - 6] class RealBit(RawBits): static_size = 1 def __init__(self, parent, name, description=None): RawBits.__init__(self, parent, name, 1, description=description) def createValue(self): return self._parent.stream.readBits(self.absolute_address, 1, BIG_ENDIAN) class NoteInfo(StaticFieldSet): format = ( (RawBits, "unused", 2), (RealBit, "has_parameter"), (RealBit, "has_type"), (RealBit, "has_volume"), (RealBit, "has_instrument"), (RealBit, "has_note") ) EFFECT_NAME = ( "Arppegio", "Porta up", "Porta down", "Tone porta", "Vibrato", "Tone porta+Volume slide", "Vibrato+Volume slide", "Tremolo", "Set panning", "Sample offset", "Volume slide", "Position jump", "Set volume", "Pattern break", None, "Set tempo/BPM", "Set global volume", "Global volume slide", "Unused", "Unused", "Unused", "Set envelope position", "Unused", "Unused", "Panning slide", "Unused", "Multi retrig note", "Unused", "Tremor", "Unused", "Unused", "Unused", None) EFFECT_E_NAME = ( "Unknown", "Fine porta up", "Fine porta down", "Set gliss control", "Set vibrato control", "Set finetune", "Set loop begin/loop", "Set tremolo control", "Retrig note", "Fine volume slide up", "Fine volume slide down", "Note cut", "Note delay", "Pattern delay") class Effect(RawBits): def __init__(self, parent, name): RawBits.__init__(self, parent, name, 8) def createValue(self): t = self.parent.stream.readBits(self.absolute_address, 8, LITTLE_ENDIAN) param = self.parent.stream.readBits(self.absolute_address+8, 8, LITTLE_ENDIAN) if t == 0x0E: return EFFECT_E_NAME[param>>4] + " %i" % (param&0x07) elif t == 0x21: return ("Extra fine porta up", "Extra fine porta down")[param>>4] else: return EFFECT_NAME[t] class Note(FieldSet): def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) self.flags = self.stream.readBits(self.absolute_address, 8, LITTLE_ENDIAN) if self.flags&0x80: # TODO: optimize bitcounting with a table: # http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetTable self._size = 8 if self.flags&0x01: self._size += 8 if self.flags&0x02: self._size += 8 if self.flags&0x04: self._size += 8 if self.flags&0x08: self._size += 8 if self.flags&0x10: self._size += 8 else: self._size = 5*8 def createFields(self): # This stupid shit gets the LSB, not the MSB... self.info("Note info: 0x%02X" % self.stream.readBits(self.absolute_address, 8, LITTLE_ENDIAN)) yield RealBit(self, "is_extended") if self["is_extended"].value: info = NoteInfo(self, "info") yield info if info["has_note"].value: yield Enum(UInt8(self, "note"), NOTE_NAME) if info["has_instrument"].value: yield UInt8(self, "instrument") if info["has_volume"].value: yield textHandler(UInt8(self, "volume"), parseVolume) if info["has_type"].value: yield Effect(self, "effect_type") if info["has_parameter"].value: yield textHandler(UInt8(self, "effect_parameter"), hexadecimal) else: yield Enum(Bits(self, "note", 7), NOTE_NAME) yield UInt8(self, "instrument") yield textHandler(UInt8(self, "volume"), parseVolume) yield Effect(self, "effect_type") yield textHandler(UInt8(self, "effect_parameter"), hexadecimal) def createDescription(self): if "info" in self: info = self["info"] desc = [] if info["has_note"].value: desc.append(self["note"].display) if info["has_instrument"].value: desc.append("instrument %i" % self["instrument"].value) if info["has_volume"].value: desc.append(self["has_volume"].display) if info["has_type"].value: desc.append("effect %s" % self["effect_type"].value) if info["has_parameter"].value: desc.append("parameter %i" % self["effect_parameter"].value) else: desc = (self["note"].display, "instrument %i" % self["instrument"].value, self["has_volume"].display, "effect %s" % self["effect_type"].value, "parameter %i" % self["effect_parameter"].value) if desc: return "Note %s" % ", ".join(desc) else: return "Note" class Row(FieldSet): def createFields(self): for index in xrange(self["/header/channels"].value): yield Note(self, "note[]") def createPatternContentSize(s, addr): return 8*(s.stream.readBits(addr, 32, LITTLE_ENDIAN) + s.stream.readBits(addr+7*8, 16, LITTLE_ENDIAN)) class Pattern(FieldSet): def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) self._size = createPatternContentSize(self, self.absolute_address) def createFields(self): yield UInt32(self, "header_size", r"Header length (9)") yield UInt8(self, "packing_type", r"Packing type (always 0)") yield UInt16(self, "rows", r"Number of rows in pattern (1..256)") yield UInt16(self, "data_size", r"Packed patterndata size") rows = self["rows"].value self.info("Pattern: %i rows" % rows) for index in xrange(rows): yield Row(self, "row[]") def createDescription(self): return "Pattern with %i rows" % self["rows"].value class Header(FieldSet): MAGIC = "Extended Module: " static_size = 336*8 def createFields(self): yield String(self, "signature", 17, "XM signature", charset="ASCII") yield String(self, "title", 20, "XM title", charset="ASCII", strip=' ') yield UInt8(self, "marker", "Marker (0x1A)") yield String(self, "tracker_name", 20, "XM tracker name", charset="ASCII", strip=' ') yield UInt8(self, "format_minor") yield UInt8(self, "format_major") yield filesizeHandler(UInt32(self, "header_size", "Header size (276)")) yield UInt16(self, "song_length", "Length in patten order table") yield UInt16(self, "restart", "Restart position") yield UInt16(self, "channels", "Number of channels (2,4,6,8,10,...,32)") yield UInt16(self, "patterns", "Number of patterns (max 256)") yield UInt16(self, "instruments", "Number of instruments (max 128)") yield Bit(self, "amiga_ftable", "Amiga frequency table") yield Bit(self, "linear_ftable", "Linear frequency table") yield Bits(self, "unused", 14) yield UInt16(self, "tempo", "Default tempo") yield UInt16(self, "bpm", "Default BPM") yield GenericVector(self, "pattern_order", 256, UInt8, "order") def createDescription(self): return "'%s' by '%s'" % ( self["title"].value, self["tracker_name"].value) class XMModule(Parser): PARSER_TAGS = { "id": "fasttracker2", "category": "audio", "file_ext": ("xm",), "mime": ( u'audio/xm', u'audio/x-xm', u'audio/module-xm', u'audio/mod', u'audio/x-mod'), "magic": ((Header.MAGIC, 0),), "min_size": Header.static_size +29*8, # Header + 1 empty instrument "description": "FastTracker2 module" } endian = LITTLE_ENDIAN def validate(self): header = self.stream.readBytes(0, 17) if header != Header.MAGIC: return "Invalid signature '%s'" % header if self["/header/header_size"].value != 276: return "Unknown header size (%u)" % self["/header/header_size"].value return True def createFields(self): yield Header(self, "header") for index in xrange(self["/header/patterns"].value): yield Pattern(self, "pattern[]") for index in xrange(self["/header/instruments"].value): yield Instrument(self, "instrument[]") # Metadata added by ModPlug - can be discarded for field in ParseModplugMetadata(self): yield field def createContentSize(self): # Header size size = Header.static_size # Add patterns size for index in xrange(self["/header/patterns"].value): size += createPatternContentSize(self, size) # Add instruments size for index in xrange(self["/header/instruments"].value): size += createInstrumentContentSize(self, size) # Not reporting Modplug metadata return size def createDescription(self): return self["header"].description
15,130
Python
.py
337
36.275964
93
0.616825
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,622
flac.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/flac.pyc
—Ú Œ »Mc@sVdZddklZddklZlZlZlZlZl Z l Z l Z l Z ddk lZlZddklZddklZdefdÑÉYZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdS(sú FLAC (audio) parser Documentation: * http://flac.sourceforge.net/format.html Author: Esteban Loiseau <baal AT tuxfamily.org> Creation date: 2008-04-09 iˇˇˇˇ(tParser( tFieldSettStringtBittBitstUInt16tUInt24tRawBytestEnumt NullBytes(t BIG_ENDIANt LITTLE_ENDIAN(t createDict(tparseVorbisCommentt VorbisCommentcBseZeZeZRS((t__name__t __module__R tendianR t createFields(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRst StreamInfocBseZdZdÑZRS(i"iccs¨t|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d d ÉVt|d d dÉVt|dddÉVt|dddÉVt|dddÉVdS(Ntmin_block_sizes6The minimum block size (in samples) used in the streamtmax_block_sizes6The maximum block size (in samples) used in the streamtmin_frame_sizes4The minimum frame size (in bytes) used in the streamtmax_frame_sizes4The maximum frame size (in bytes) used in the streamt sample_hertzisSample rate in Hertzt nb_channelisNumber of channels minus onetbits_per_sampleisBits per sample minus onet total_samplesi$sTotal samples in streamtmd5sumis)MD5 signature of the unencoded audio data(RRRR(tself((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRsi(RRt static_sizeR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRst SeekPointcBseZdÑZRS(ccs=t|dddÉVt|dddÉVt|ddÉVdS(Nt sample_numberi@s Sample numbertoffsetsOffset in bytest nb_samplei(R(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR$s(RRR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR#st SeekTablecBseZdÑZRS(ccs$x|ipt|dÉVqWdS(Nspoint[](teofR(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR*s (RRR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR#)st MetadataBlockcBsÅeZdZhddefd6dd6dd 6d d efd 6d defd6dd6dd6ZeedÉZ dÑZ dÑZ RS(sLMetadata block field: http://flac.sourceforge.net/format.html#metadata_blockt stream_infou Stream infois padding[]uPaddingis application[]u Applicationit seek_tableu Seek tableitcommentuVorbis commentis cue_sheet[]u Cue sheetis picture[]uPictureicOs~ti|||éd|did|_y0|di}|i|\|_|_|_Wntj od|_nXdS(Ni tmetadata_lengthit block_type( Rt__init__tvaluet_sizet BLOCK_TYPESt_namet _descriptionthandlertKeyErrortNone(Rtargstkwtkey((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR+<s #c cs˙t|ddÉVtt|dddÉ|iÉVt|ddÉV|di}|di}|pdSy|i|d}Wntj o d}nX|o||d d |d ÉVn;|did jot |d |ÉVnt |d|ÉVdS(Ntlast_metadata_blocks'True if this is the last metadata blockR*isMetadata block header typeR)sCLength of following metadata in bytes (doesn't include this header)itcontenttsizeiitpaddingtrawdata( RRRtBLOCK_TYPE_DESCRR,R.R2R3R R(RR*R9R1((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyREs     N(s padding[]uPaddingN(s application[]u ApplicationN(s cue_sheet[]u Cue sheetN(s picture[]uPictureN( RRt__doc__RR3R#RR.R R<R+R(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR%.s  tMetadatacBseZdÑZRS(ccs=x6|ip+t|dÉ}|V|dioPqqWdS(Nsmetadata_block[]R7(R$R%R,(Rtfield((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRZs  (RRR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR>YstFramecBsÄeZhdd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6ZdÑZRS(s"get from STREAMINFO metadata blockis88.2kHzis176.4kHzit192kHzit8kHzit16kHzis22.05kHzit24kHzit32kHzis44.1kHzi t48kHzi t96kHzi s1get 8 bit sample rate (in kHz) from end of headeri s1get 16 bit sample rate (in Hz) from end of headeri s9get 16 bit sample rate (in tens of Hz) from end of headericcsít|dddÉVt|dÉVt|dÉVt|ddÉVtt|ddÉ|iÉVt|d dÉVt|d d ÉVt|dÉVdS( NtsyncisSync code: 11111111111110s reserved[]tblocking_strategyt block_sizeit sample_ratetchannel_assignt sample_sizei(RRRt SAMPLE_RATES(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRts(RRRNR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyR@as" tFramescBseZdÑZRS(ccs%x|ipt|dÉVdSWdS(Nsframe[](R$R@(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRÄs (RRR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyROst FlacParsercBsleZdZdZhdd6dd6dd6dd6ed ffd 6dd 6dd6ZeZdÑZdÑZRS(s6Parse FLAC audio files: FLAC is a lossless audio codectfLaCtflactidtaudiotcategorytfile_extu audio/x-flactmimeitmagiciitmin_sizes FLAC audiot descriptioncCs1|iidt|iÉÉ|ijodStS(NiuInvalid magic string(tstreamt readBytestlentMAGICtTrue(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pytvalidateîs(ccs=t|ddddddÉVt|dÉVt|dÉVdS( Nt signatureitcharsettASCIIRZsFLAC signature: fLaC stringtmetadatatframes(RR>RO(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRôs(RR(u audio/x-flaci ( RRR=R^t PARSER_TAGSR RR`R(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyRPÜs  N(R=thachoir_parserRthachoir_core.fieldRRRRRRRRR thachoir_core.streamR R thachoir_core.toolsR thachoir_parser.container.oggR RRRR#R%R>R@RORP(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/audio/flac.pyt<module> s@ +
8,691
Python
.py
44
196.431818
1,263
0.490573
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,623
xm.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/xm.pyc
—Ú Œ »Mc'@s*dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZddklZlZddklZlZlZddklZddklZdÑZd Zd ZdWZdefdÑÉYZ defdÑÉYZ!defdÑÉYZ"defdÑÉYZ#dÑZ$defdÑÉYZ%dXZ&d%ÑZ'd&efd'ÑÉYZ(d(efd)ÑÉYZ)dYZ+dZZ,dIefdJÑÉYZ-dKefdLÑÉYZ.dMefdNÑÉYZ/dOÑZ0dPefdQÑÉYZ1dRefdSÑÉYZ2dTefdUÑÉYZ3dVS([sè Parser of FastTrackerII Extended Module (XM) version 1.4 Documents: - Modplug source code (file modplug/soundlib/Load_xm.cpp) http://sourceforge.net/projects/modplug - Dumb source code (files include/dumb.h and src/it/readxm.c http://dumb.sf.net/ - Documents of "XM" format on Wotsit http://www.wotsit.org Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 8th February 2007 iˇˇˇˇ(tParser( tStaticFieldSettFieldSettBittRawBitstBitstUInt32tUInt16tUInt8tInt8tEnumtRawBytestStringt GenericVector(t LITTLE_ENDIANt BIG_ENDIAN(t textHandlertfilesizeHandlert hexadecimal(tParseModplugMetadata(t NOTE_NAMEcCsd|idS(Ns%iiÄ(tvalue(tval((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyt parseSignedsgcyŸíèÛ?gq]ıûÏ?sNo loops Forward loopsPing-pong looptUndeft SampleTypecBseZdZdÑZRS(iccsNt|ddÉVt|dÉVt|ddÉVtt|ddÉtÉVdS(Nsunused[]it16bitsit loop_modei(RRR tSAMPLE_LOOP_MODE(tself((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyt createFields%s(t__name__t __module__t static_sizeR(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR#st SampleHeadercBs eZdZdÑZdÑZRS(i(iccsüt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|d ÉVt|d d d d ddÉVdS(Ntlengtht loop_starttloop_endtvolumet fine_tunettypetpanningt relative_notetreservedtnameitcharsettASCIItstrips (RRR RR (R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR-scCssd|di}tdtt|diÉtt|didÉÉ}d|did ||d i||fS( Nis type/16bitsgÄU–@R*R'is%s, %ubits, %u samples, %uHzR,iR#(Rtinttpowt SEMITONE_BASEt PITCH_BASEtdisplay(RtbytestC5_speed((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyt createValue9s 5i@(RR R!RR7(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR"+s t StuffTypecBs5eZeddfedfedfedffZRS(tunuseditlooptsustainton(RR RRtformat(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR8@s   tInstrumentSecondHeadercBseZdZdÑZRS(iÍiccsFt|dÉVt|ddtdÉVt|ddtdÉVt|ddtdÉVt|d d ÉVt|d d ÉVt|d ÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|ddtdÉVdS(Ntsample_header_sizetnotesi`tsampletvolume_envelopeitpointtpanning_envelopet volume_pointssNumber of volume pointstpanning_pointssNumber of panning pointstvolume_sustain_pointtvolume_loop_start_pointtvolume_loop_end_pointtpanning_sustain_pointtpanning_loop_start_pointtpanning_loop_end_pointt volume_typet panning_typet vibrato_typet vibrato_sweept vibrato_deptht vibrato_ratetvolume_fadeoutR+i tword(RR RRR8(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRJs(iP(RR R!R(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR>HscCs£|}|ii|ddtÉ}|d|ii|dtÉ7}d}|oDxAt|ÉD]/}||ii|dtÉ7}|ti7}q\Wn||d|S(Niiii iiÿ(tstreamtreadBitsRtxrangeR"R!(tstaddrtstarttsamplest sample_sizetindex((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pytcreateInstrumentContentSize`s  t InstrumentcBs,eZdÑZdÑZdÑZdÑZRS(cCs?ti|||Ét||iÉ|_|i|iÉÉdS(N(Rt__init__R^tabsolute_addresst_sizetinfotcreateDescription(RtparentR,((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR`qsccs8|di|id}|ot|d|ÉVndS(Ntsizeit unknown_data(Rt current_sizeR (RRf((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pytfixInstrumentHeaderwsc cs1t|dÉVt|ddddddÉVt|dÉVt|d ÉV|d i}|i|iÉÉ|o£t|d ÉVx|iÉD] }|VqâWg}x<t |ÉD].}t |d É}|V|i |d iÉq´WxM|D]%}|ot |d |dÉVq‰q‰Wnx|iÉD] }|VqWdS(NRfR,iR-R.R/s R(R[t second_headerssample_header[]R#s sample_data[]tDeltas( RR RRRRcRdR>RiRWR"tappendR (RtnumtfieldR\R]RARf((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR|s0      cCs&d|di|di|difS(Ns,Instrument '%s': %i samples, header %i bytesR,R[Rf(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRdös(RR R`RiRRd(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR_ps   sVolume slide downsVolume slide upsFine volume slide downsFine volume slide upsSet vibrato speedtVibratos Set panningsPanning slide leftsPanning slide rights Tone portat UnhandledcCsH|i}d|jo djno d|dSt|ddSdS(NiiPs Volume %ii(Rt VOLUME_NAME(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyt parseVolume§s  tRealBitcBs#eZdZddÑZdÑZRS(icCs ti|||dd|ÉdS(Nit description(RR`(RReR,Rt((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR`ÆscCs|iii|idtÉS(Ni(t_parentRURVRaR(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR7±sN(RR R!tNoneR`R7(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRs´s tNoteInfocBsGeZeddfedfedfedfedfedffZRS(R9it has_parameterthas_typet has_volumethas_instrumentthas_note(RR RRsR=(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRw¥s      tArppegiosPorta ups Porta downsTone porta+Volume slidesVibrato+Volume slidetTremolos Sample offsets Volume slides Position jumps Set volumes Pattern breaks Set tempo/BPMsSet global volumesGlobal volume slidetUnusedsSet envelope positions Panning slidesMulti retrig notetTremortUnknowns Fine porta upsFine porta downsSet gliss controlsSet vibrato controls Set finetunesSet loop begin/loopsSet tremolo controls Retrig notesNote cuts Note delays Pattern delaytEffectcBseZdÑZdÑZRS(cCsti|||dÉdS(Ni(RR`(RReR,((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR`–scCså|iii|idtÉ}|iii|iddtÉ}|djot|d?d|d@S|djo d |d?St|SdS( Niiis %iii!sExtra fine porta upsExtra fine porta down(sExtra fine porta upsExtra fine porta down(ReRURVRaRt EFFECT_E_NAMEt EFFECT_NAME(Rtttparam((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR7”s"   (RR R`R7(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRÇœs tNotecBs&eZddÑZdÑZdÑZRS(cCsti||||É|ii|idtÉ|_|id@o≤d|_|id@o|id7_n|id@o|id7_n|id@o|id7_n|id@o|id7_n|id@o|id7_q˝n d|_dS( NiiÄiiiiii((RR`RURVRaRtflagsRb(RReR,tdesc((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR`fis ccs}|id|ii|idtÉÉt|dÉV|dio”t|dÉ}|V|diott |dÉt ÉVn|diot |dÉVn|d iot t |d Ét ÉVn|d iot |d ÉVn|d iot t |dÉtÉVqynett|ddÉt ÉVt |dÉVt t |d Ét ÉVt |d ÉVt t |dÉtÉVdS(NsNote info: 0x%02Xit is_extendedRcR|tnoteR{t instrumentRzR&Ryt effect_typeRxteffect_parameteri(RcRURVRaRRsRRwR RRRRrRÇRR(RRc((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRÌs* cCsPd|jofi|d}g}|dio|i|diÉn|dio|id|diÉn|dio|i|diÉn|dio|id |d iÉn|d io|id |d iÉq/nE|did|di|did |d id |d if}|oddi|ÉSdSdS(NRcR|RãR{s instrument %iRåRzRys effect %sRçRxs parameter %iRésNote %ss, Rá(RRlR4tjoin(RRcRâ((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRds&   N(RR RvR`RRd(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRá›s  tRowcBseZdÑZRS(ccs0x)t|diÉD]}t|dÉVqWdS(Ns/header/channelssnote[](RWRRá(RR]((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRs(RR R(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRêscCs4d|ii|dtÉ|ii|ddtÉS(Nii iii8(RURVR(RXRY((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pytcreatePatternContentSize"stPatterncBs&eZddÑZdÑZdÑZRS(cCs/ti||||Ét||iÉ|_dS(N(RR`RëRaRb(RReR,Râ((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR`'sccsãt|ddÉVt|ddÉVt|ddÉVt|ddÉV|di}|id |Éx"t|ÉD]}t|d ÉVqoWdS( Nt header_sizesHeader length (9)t packing_typesPacking type (always 0)trowss"Number of rows in pattern (1..256)t data_sizesPacked patterndata sizesPattern: %i rowssrow[](RRRRRcRWRê(RRïR]((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR+s  cCsd|diS(NsPattern with %i rowsRï(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRd5sN(RR RvR`RRd(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRí&s  tHeadercBs&eZdZdZdÑZdÑZRS(sExtended Module: iPic csct|dddddÉVt|dddddd d ÉVt|d d ÉVt|d ddddd d ÉVt|dÉVt|dÉVtt|ddÉÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|dd ÉVt|d!d"ÉVt|d#d$ÉVt|d%d&ÉVt|d'd(td)ÉVdS(*Nt signatureis XM signatureR-R.ttitleisXM titleR/t tmarkers Marker (0x1A)t tracker_namesXM tracker namet format_minort format_majorRìsHeader size (276)t song_lengthsLength in patten order tabletrestartsRestart positiontchannelss&Number of channels (2,4,6,8,10,...,32)tpatternssNumber of patterns (max 256)t instrumentssNumber of instruments (max 128)t amiga_ftablesAmiga frequency tablet linear_ftablesLinear frequency tableR9ittempos Default tempotbpms Default BPMt pattern_orderitorder(R RRRRRRR (R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR<s$  cCsd|di|difS(Ns '%s' by '%s'RôRú(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRdPsiÄ (RR tMAGICR!RRd(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRó8s tXMModulecBs|eZhdd6dd6dd6dd 6eid ffd 6eidd6dd6ZeZdÑZdÑZ dÑZ dÑZ RS(t fasttracker2tidtaudiotcategorytxmtfile_extuaudio/xmu audio/x-xmuaudio/module-xmu audio/modu audio/x-modtmimeitmagiciitmin_sizesFastTracker2 moduleRtcCsV|iiddÉ}|tijo d|S|didjod|diStS(NiisInvalid signature '%s's/header/header_sizeisUnknown header size (%u)(RUt readBytesRóR™RtTrue(Rtheader((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pytvalidatebs  ccsÜt|dÉVx)t|diÉD]}t|dÉVq"Wx)t|diÉD]}t|dÉVqNWxt|ÉD] }|VqsWdS(NR∑s/header/patternss pattern[]s/header/instrumentss instrument[](RóRWRRíR_R(RR]Rn((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRjs cCsoti}x.t|diÉD]}|t||É7}qWx.t|diÉD]}|t||É7}qNW|S(Ns/header/patternss/header/instruments(RóR!RWRRëR^(RRfR]((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pytcreateContentSizeus cCs |diS(NR∑(Rt(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyRdÑs(R∞(uaudio/xmu audio/x-xmuaudio/module-xmu audio/modu audio/x-modiË( RR RóR™R!t PARSER_TAGSRtendianR∏RRπRd(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyR´Ts   N(sNo loops Forward loopsPing-pong loopR( sVolume slide downsVolume slide upsFine volume slide downsFine volume slide upsSet vibrato speedRos Set panningsPanning slide leftsPanning slide rights Tone portaRp(!R}sPorta ups Porta downs Tone portaRosTone porta+Volume slidesVibrato+Volume slideR~s Set pannings Sample offsets Volume slides Position jumps Set volumes Pattern breakNs Set tempo/BPMsSet global volumesGlobal volume slidesUnusedsUnusedsUnusedsSet envelope positionsUnusedsUnuseds Panning slidesUnusedsMulti retrig notesUnusedRÄsUnusedsUnusedsUnusedN(sUnknowns Fine porta upsFine porta downsSet gliss controlsSet vibrato controls Set finetunesSet loop begin/loopsSet tremolo controls Retrig notesFine volume slide upsFine volume slide downsNote cuts Note delays Pattern delay(4t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R thachoir_core.endianRRthachoir_core.text_handlerRRRthachoir_parser.audio.modplugRthachoir_parser.common.trackerRRR2R3RRR"R8R>R^R_RqRrRsRwRvRÑRÉRÇRáRêRëRíRóR´(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/audio/xm.pyt<module>sVX  /   @ 
19,410
Python
.py
62
311.903226
1,532
0.467411
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,624
midi.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/midi.py
""" Musical Instrument Digital Interface (MIDI) audio file parser. Documentation: - Standard MIDI File Format, Dustin Caldwell (downloaded on wotsit.org) Author: Victor Stinner Creation: 27 december 2006 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Bits, ParserError, String, UInt32, UInt24, UInt16, UInt8, Enum, RawBytes) from hachoir_core.endian import BIG_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.tools import createDict, humanDurationNanosec from hachoir_parser.common.tracker import NOTE_NAME MAX_FILESIZE = 10 * 1024 * 1024 class Integer(Bits): def __init__(self, parent, name, description=None): Bits.__init__(self, parent, name, 8, description) stream = parent.stream addr = self.absolute_address value = 0 while True: bits = stream.readBits(addr, 8, parent.endian) value = (value << 7) + (bits & 127) if not(bits & 128): break addr += 8 self._size += 8 if 32 < self._size: raise ParserError("Integer size is bigger than 32-bit") self.createValue = lambda: value def parseNote(parser): yield Enum(UInt8(parser, "note", "Note number"), NOTE_NAME) yield UInt8(parser, "velocity") def parseControl(parser): yield UInt8(parser, "control", "Controller number") yield UInt8(parser, "value", "New value") def parsePatch(parser): yield UInt8(parser, "program", "New program number") def parseChannel(parser): yield UInt8(parser, "channel", "Channel number") def parsePitch(parser): yield UInt8(parser, "bottom", "(least sig) 7 bits of value") yield UInt8(parser, "top", "(most sig) 7 bits of value") def parseText(parser, size): yield String(parser, "text", size) def formatTempo(field): return humanDurationNanosec(field.value*1000) def parseTempo(parser, size): yield textHandler(UInt24(parser, "microsec_quarter", "Microseconds per quarter note"), formatTempo) def parseTimeSignature(parser, size): yield UInt8(parser, "numerator", "Numerator of time signature") yield UInt8(parser, "denominator", "denominator of time signature 2=quarter 3=eighth, etc.") yield UInt8(parser, "nb_tick", "Number of ticks in metronome click") yield UInt8(parser, "nb_32nd_note", "Number of 32nd notes to the quarter note") class Command(FieldSet): COMMAND = {} for channel in xrange(16): COMMAND[0x80+channel] = ("Note off (channel %u)" % channel, parseNote) COMMAND[0x90+channel] = ("Note on (channel %u)" % channel, parseNote) COMMAND[0xA0+channel] = ("Key after-touch (channel %u)" % channel, parseNote) COMMAND[0xB0+channel] = ("Control change (channel %u)" % channel, parseControl) COMMAND[0xC0+channel] = ("Program (patch) change (channel %u)" % channel, parsePatch) COMMAND[0xD0+channel] = ("Channel after-touch (channel %u)" % channel, parseChannel) COMMAND[0xE0+channel] = ("Pitch wheel change (channel %u)" % channel, parsePitch) COMMAND_DESC = createDict(COMMAND, 0) COMMAND_PARSER = createDict(COMMAND, 1) META_COMMAND_TEXT = 1 META_COMMAND_NAME = 3 META_COMMAND = { 0x00: ("Sets the track's sequence number", None), 0x01: ("Text event", parseText), 0x02: ("Copyright info", parseText), 0x03: ("Sequence or Track name", parseText), 0x04: ("Track instrument name", parseText), 0x05: ("Lyric", parseText), 0x06: ("Marker", parseText), 0x07: ("Cue point", parseText), 0x2F: ("End of the track", None), 0x51: ("Set tempo", parseTempo), 0x58: ("Time Signature", parseTimeSignature), 0x59: ("Key signature", None), 0x7F: ("Sequencer specific information", None), } META_COMMAND_DESC = createDict(META_COMMAND, 0) META_COMMAND_PARSER = createDict(META_COMMAND, 1) def createFields(self): yield Integer(self, "time", "Delta time in ticks") yield Enum(textHandler(UInt8(self, "command"), hexadecimal), self.COMMAND_DESC) command = self["command"].value if command == 0xFF: yield Enum(textHandler(UInt8(self, "meta_command"), hexadecimal), self.META_COMMAND_DESC) yield UInt8(self, "data_len") size = self["data_len"].value if size: command = self["meta_command"].value if command in self.META_COMMAND_PARSER: parser = self.META_COMMAND_PARSER[command] else: parser = None if parser: for field in parser(self, size): yield field else: yield RawBytes(self, "data", size) else: if command not in self.COMMAND_PARSER: raise ParserError("Unknown command: %s" % self["command"].display) parser = self.COMMAND_PARSER[command] for field in parser(self): yield field def createDescription(self): if "meta_command" in self: return self["meta_command"].display else: return self["command"].display class Track(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) self._size = (8 + self["size"].value) * 8 def createFields(self): yield String(self, "marker", 4, "Track marker (MTrk)", charset="ASCII") yield UInt32(self, "size") if True: while not self.eof: yield Command(self, "command[]") else: size = self["size"].value if size: yield RawBytes(self, "raw", size) def createDescription(self): command = self["command[0]"] if "meta_command" in command \ and command["meta_command"].value in (Command.META_COMMAND_TEXT, Command.META_COMMAND_NAME) \ and "text" in command: return command["text"].value.strip("\r\n") else: return "" class Header(FieldSet): static_size = 10*8 FILE_FORMAT = { 0: "Single track", 1: "Multiple tracks, synchronous", 2: "Multiple tracks, asynchronous", } def createFields(self): yield UInt32(self, "size") yield Enum(UInt16(self, "file_format"), self.FILE_FORMAT) yield UInt16(self, "nb_track") yield UInt16(self, "delta_time", "Delta-time ticks per quarter note") def createDescription(self): return "%s; %s tracks" % ( self["file_format"].display, self["nb_track"].value) class MidiFile(Parser): MAGIC = "MThd" PARSER_TAGS = { "id": "midi", "category": "audio", "file_ext": ["mid", "midi"], "mime": (u"audio/mime", ), "magic": ((MAGIC, 0),), "min_size": 64, "description": "MIDI audio" } endian = BIG_ENDIAN def validate(self): if self.stream.readBytes(0, 4) != self.MAGIC: return "Invalid signature" if self["header/size"].value != 6: return "Invalid header size" return True def createFields(self): yield String(self, "signature", 4, r"MIDI signature (MThd)", charset="ASCII") yield Header(self, "header") while not self.eof: yield Track(self, "track[]") def createDescription(self): return "MIDI audio: %s" % self["header"].description def createContentSize(self): count = self["/header/nb_track"].value - 1 start = self["track[%u]" % count].absolute_address # Search "End of track" of last track end = self.stream.searchBytes("\xff\x2f\x00", start, MAX_FILESIZE*8) if end is not None: return end + 3*8 return None
7,888
Python
.py
186
34.05914
103
0.618613
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,625
s3m.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/audio/s3m.pyc
—Ú Œ »Mc@sadZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZddklZddklZlZddklZddGdÑÉYZd dHd ÑÉYZd efd ÑÉYZd ÑZdefdÑÉYZdefdÑÉYZdefdÑÉYZ de fdÑÉYZ!de!fdÑÉYZ"de!fdÑÉYZ#defdÑÉYZ$defdÑÉYZ%de fdÑÉYZ&d e&fd!ÑÉYZ'd"e fd#ÑÉYZ(d$e(fd%ÑÉYZ)d&efd'ÑÉYZ*d(e(fd)ÑÉYZ+d*efd+ÑÉYZ,d,efd-ÑÉYZ-d.efd/ÑÉYZ.d0e.fd1ÑÉYZ/d2e.fd3ÑÉYZ0d4efd5ÑÉYZ1d6e1fd7ÑÉYZ2d8e1fd9ÑÉYZ3d:e fd;ÑÉYZ4d<e4fd=ÑÉYZ5d>e4fd?ÑÉYZ6d@efdAÑÉYZ7dBe7fdCÑÉYZ8dDe7fdEÑÉYZ9dFS(Is‘ The ScreamTracker 3.0x module format description for .s3m files. Documents: - Search s3m on Wotsit http://www.wotsit.org/ Author: Christophe GISQUET <christophe.gisquet@free.fr> Creation: 11th February 2007 iˇˇˇˇ(tParser(tStaticFieldSettFieldSettFieldtBittBitstUInt32tUInt16tUInt8tEnumt PaddingBytestRawBytest NullBytestStringt GenericVectort ParserError(t LITTLE_ENDIAN(t textHandlert hexadecimal(t alignValuetChunkcBseZdÑZRS(cGsR|djo |djptÇ||_||_||_||_||_dS(Ni(tNonetAssertionErrortclstnametoffsettsizetargs(tselfRRRRR((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyt__init__s !    (t__name__t __module__R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRst ChunkIndexercBs,eZdÑZdÑZdÑZdÑZRS(cCs g|_dS(N(tchunks(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR!scCs?|djo.|i|i|i|dijotSntS(Ni(RRR!tFalsetTrue(Rtchunktindex((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pytcanHouse%s % cCs§d}xá|t|iÉjop|i|i}||ijoB|i||Éptd|iÉÇn|ii||ÉdS|d7}q W|ii|ÉdS(NisChunk '%s' doesn't fit!i(tlenR!RR&RRtinserttappend(Rt new_chunkR%R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pytaddChunk-sc csÌxÊt|iÉdjoœ|iiÉ}|id}|i|}|djo?|id|||ifÉt|d|ÉV|id}nd}|i}xW|i|joF|d7}|iiÉ}|djo|id||fÉdSq†W|i|}|djo5|id||||ifÉt|d|ÉVn|id |i |ifÉ|i ||i |i |i å}|Vt |d ÉoKxH|iÉD]6}|id |i|i |i fÉ|i|Éq¶WqqWdS( Niis-Padding of %u bytes needed: curr=%u offset=%us padding[]is/Couldn't resynch: %u object skipped to reach %us9Skipped %u objects to resynch to %u; chunk offset: %u->%us resynch[]s(Yielding element of size %u at offset %ut getSubChunkss/Adding sub chunk: position=%u size=%u name='%s'(R'R!tpopt current_sizeRtinfoR RR RRRRthasattrR,R+( RtobjR$t current_posRtcounttold_offtfieldt sub_chunk((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyt yieldChunks=sF             !  (RRRR&R+R7(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR s   tS3MFlagsc BszeZeddfeddfeddfeddfedd fed d fed d feddfeddff ZRS(t st2_vibratos&Vibrato (File version 1/ScreamTrack 2)t st2_tempos$Tempo (File version 1/ScreamTrack 2)t amiga_slidess+Amiga slides (File version 1/ScreamTrack 2)t zero_vol_optsJAutomatically turn off looping notes whose volume is zero for >2 note rowst amiga_limitss*Disallow notes beyond Amiga hardware specst sb_processings#Enable filter/SFX with SoundBlastert vol_slides(Volume slide also performed on first rowtextendedsSpecial custom data in filesunused[]i(RRRRtformat(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR8ms        cCs[|i}|djo d|S|djo d|dS|djo d|dSd|S(NisLeft Sample Channel %uisRight Sample Channel %ui sAdlib channel %usValue %u unknown(tvalue(tval((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pytparseChannelTypezs       tChannelSettingscBseZdZdÑZRS(iccs,tt|ddÉtÉVt|dÉVdS(Nttypeitenabled(RRRDR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyt createFieldsÜs(RRt static_sizeRH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyREÑstChannelPanningcBseZdZdÑZRS(iccsHt|dddÉVt|dÉVt|ddÉVt|ddÉVdS(Ntdefault_positionisDefault pan positions reserved[]t use_defaults!Bits 0:3 specify default positioni(RR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRHås(RRRIRH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRJäst SizeFieldSetcBs2eZdZdZddÑZdÑZdÑZRS(s! Provide an automatic constructor for a sized field that can be aligned on byte positions according to ALIGN. Size is ignored if static_size is set. Real size is stored for convenience, but beware, it is not in bits, but in bytes. Field can be automatically padded, unless: - size is 0 (unknown, so padding doesn't make sense) - it shouldn't be aligned If it shouldn't be aligned, two solutions: - change _size to another value than the one found through aligment. - derive a class with ALIGN = 0. icCsOti||||É|o.||_|idjo|i|ÉqKndS(N(RRt real_sizeRIRtsetCheckedSizes(RtparentRRtdesc((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR§s  cCsö||_|d9}|io(t|i|d|iÉ|i}n|iio;|ii||iijo|ii|ii}qçn||_dS(Ni(RNtALIGNRtabsolute_addresst_parentt_sizeR.(RR((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRO´s    ccsVx|iÉD] }|Vq W|i|id}|djot|d|ÉVndS(Niitpadding(tcreateUnpaddedFieldsRUR.R (RR5R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRHπs    N(RRt__doc__RRRRRORH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRMìs   tHeadercBs#eZdÑZdÑZdÑZRS(cCs&d|di|di|difS(Ns %s (%u patterns, %u instruments)ttitlet num_patternstnum_instruments(RB(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pytcreateDescription¡scCs |diS(NRZ(RB(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyt createValue∆sc cst|ddddÉVtt|dÉtÉVx|iÉD] }|Vq;Wt|dÉVt|dÉVt|dÉVx|iÉD] }|VqÅWt|dd ÉVx|iÉD] }|VqÆWt|d d t d ÉVt|d |i ÉtdÉVx|i ÉD] }|Vq˛WdS(NRZitstriptsmarker[]t num_ordersR\R[itchannel_settingsi tchanneltorderstorder( R RRRtgetFileVersionFieldRtgetFirstPropertiestgetLastPropertiesRREt getNumOrderstgetHeaderEndFields(RR5((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRWÀs*         (RRR]R^RW(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRY¿s  t S3MHeadercBsPeZdZddÑZdÑZdÑZdÑZdÑZdÑZ dÑZ RS( sŒ 0 1 2 3 4 5 6 7 8 9 A B C D E F +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0000: | Song name, max 28 chars (end with NUL (0)) | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0010: | |1Ah|Typ| x | x | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0020: |OrdNum |InsNum |PatNum | Flags | Cwt/v | Ffi |'S'|'C'|'R'|'M'| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0030: |g.v|i.s|i.t|m.v|u.c|d.p| x | x | x | x | x | x | x | x |Special| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0040: |Channel settings for 32 channels, 255=unused,+128=disabled | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0050: | | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0060: |Orders; length=OrdNum (should be even) | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx1: |Parapointers to instruments; length=InsNum*2 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx2: |Parapointers to patterns; length=PatNum*2 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx3: |Channel default pan positions | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxx1=70h+orders xxx2=70h+orders+instruments*2 xxx3=70h+orders+instruments*2+patterns*2 cCswti|||||Éd|did|di|di}|didjo|d7}n|i|ÉdS( Ni`RaiR\R[t panning_infoi¸i (RYRRBRO(RRPRRRQ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRs ccs#t|dÉVt|ddÉVdS(NRFs reserved[]i(RR (R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRf sccsSt|dÉVt|dÉVt|ddÉVt|dddÉVt|dÉVdS(Ntflagstcreation_version_minortcreation_version_majoritcreation_version_unknowns(=1)tformat_version(R8RRR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRgs ccsót|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d ÉVt|d d ÉVt|d ÉVt|d dÉVt|ddÉVdS(Ntglob_vols Global volumet init_speedsInitial speed (command A)t init_temposInitial tempo (command T)tvolumeitstereot click_removals/Number of GUS channels to run to prevent clicksRls reserved[]itcustom_data_parapointers7Parapointer to special custom data (not used by ST3.01)(RRRR R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRhs cCs |diS(NRa(RB(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRi#sccs˚|di}|di}|djot|d|tdÉVn|djot|d|tdÉVn|didjoC|d id jo/|d id jot|d d tdÉVn|i|i}|djot|d|dÉVndS(NR\R[it instr_pptrRt pattern_pptrRoiRni Rli¸tchannel_panningRcRVi(RBRRRJRUR.R (RtinstrtpatternsR((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRj%s     c csçxEt|diÉD]0}ttdd|d|itidÉVqWx>t|diÉD])}ttdd|d|id ÉVq\WdS( NR\s instrument[]isinstr_pptr/offset[%u]iR[s pattern[]spattern_pptr/offset[%u]i(txrangeRBRt S3MInstrumentRIt S3MPattern(RR%((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR,9s  N( RRRXRRRfRgRhRiRjR,(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRk‰s    t PTMHeadercBsMeZd ZdÑZdÑZdÑZdÑZdÑZdÑZdÑZ RS( ii`cCs|i}d|S(NsProTracker x%04X(RB(RC((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pytgetTrackerVersionIs ccs#t|dÉVt|ddÉVdS(NRFs reserved[]i(RR (R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRfMsccs.t|dÉVt|dÉVt|dÉVdS(NtchannelsRms reserved[](R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRgQsccst|ddÉVdS(Ns reserved[]i(R (R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRhVscCsdS(Ni((R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRiYsccst|ddtdÉVdS(NRziÄR(RR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRj[sc csD|iio|i|ii}nd}|di}|i}xzt|ÉD]l}|i|tid}ttd|tidÉV|ii |d|ddt É}t ||É}qMW|di}d|d i}xJt d |ÉD]9}d|d |i}tt d |||ÉV|}qÎWtt d |||ÉVdS( NlˇgÌ]R\is instrument[]ii R[ispattern_pptr/offset[0]ispattern_pptr/offset[%u]s pattern[](RTRURSRBR~RIt PTMInstrumentRtstreamtreadBitsRtmintranget PTMPattern(Rtmin_offR3taddrR%Rtprev_off((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR,^s(     $  i( RRRIRÇRfRgRhRiRjR,(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRÅEs      t SampleFlagscBs;eZedfeddfeddfeddffZRS(tloop_onRvsSample size will be 2*lengtht16bitss!16b sample, Intel LO-HI byteordertunusedi(RRRRRA(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRç{s   t S3MUInt24cBseZdZddÑZRS(ics~ti|||ddd|É|i}|ii|dtÉd>âà|ii|ddtÉd>7âáfdÜ|_dS( NRit descriptioniiiicsàS((((RC(sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyt<lambda>äs(RRRSRÖRÜRR^(RRPRRQRã((RCsB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRÖs  $N(RRRIRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRëÉst SampleDatacBseZdÑZRS(ccst|d|iÉVdS(Ntdata(R RN(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRWçs(RRRW(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRîåst PTMSampleDatacBseZdZRS(i(RRRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRñèst InstrumentcBs)eZdZdÑZdÑZdÑZRS(iiPcCsq|dig}d|jo0|dio|idÉqM|idÉn|id|iÉÉdi|ÉS(Ntc4_speeds flags/stereoRvtmonos%u bitss, (tdisplayRBR)t getSampleBitstjoin(RR/((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR]ïs c css|iÉVt|ddddÉVx|iÉD] }|Vq/Wt|ddddÉVt|ddd ddÉVdS( Ntfilenamei R_R`RitmarkerisEither 'SCRS' or '(empty)'(tgetTypeR tgetInstrumentFields(RR5((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRH°s   cCs |diS(NR(RB(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR^´siÄ(RRRIR]RHR^(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRóís RcBsneZdZdZhdd6dd6Zhdd6dd6dd 6d d 6Zd ÑZd ÑZdÑZdÑZ RS(s∫ In fact a sample. Description follows: 0 1 2 3 4 5 6 7 8 9 A B C D E F +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0000: |[T]| Dos filename (12345678.ABC) | MemSeg | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0010: |Length |HI:leng|LoopBeg|HI:LBeg|LoopEnd|HI:Lend|Vol| x |[P]|[F]| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0020: |C2Spd |HI:C2sp| x | x | x | x |Int:Gp |Int:512|Int:lastused | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0030: | Sample name, 28 characters max... (incl. NUL) | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 0040: | ...sample name... |'S'|'C'|'R'|'S'| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ xxxx: sampledata tSCRStUnpackedit DP30ADPCMitUnknowntSamples adlib melodyis adlib drum2icCstt|dÉ|iÉS(NRF(R RtTYPE(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRüƒscCsdd|diS(Niis flags/16bits(RB(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRõ«sccs’t|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVtt|dÉ|iÉVt|dÉVt|d d ÉVt|dd ÉVt|d d ÉVt|d dÉVt|d dÉVdS(Nt sample_offsett sample_sizet loop_begintloop_endRus reserved[]tpackingRmRòsFrequency for middle C noteis internal[]sSample address in GUS memorys%Flags for SoundBlaster loop expansionsLast used position (SB)(RëRRR tPACKINGRçR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR† sccsd|di}|dio|d9}n|dio|d9}nttd|di|ÉVdS(NR®s flags/stereois flags/16bitss sample_data[]Rß(RBRRî(RR((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR,Ÿs  ( RRRXtMAGICR¨R¶RüRõR†R,(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRÆs"   tPTMTypecBs9eZhdd6dd6dd6dd6ZdZd ÑZRS( s No sampleitRegularisOPL2/OPL2 instrumentisMIDI instrumentiiccsjt|ddÉVt|dÉVt|dÉVt|dÉVt|dÉVtt|ddÉ|iÉVdS(NRêit is_tonableRèt loop_bidirtlooptorigin(RRR tTYPES(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRH‰s (RRR¥RIRH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRÆ·s"RÑcBs8eZdZdZdÑZdÑZdÑZdÑZRS(tPTMIicCs t|dÉS(NRm(RÆ(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRü˙scCsdS(Ni((R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRõ˛sccsµt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|d ÉVt|d ÉVtt|d ÉtÉVt|d ÉVdS( NRuRòtsample_segmentRßR®R©R™t gus_begintgus_loop_startt gus_loop_endtgus_loop_flagss reserved[](RRRRR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR†sccs7|di}|ottd|di|ÉVndS(NR®s sample_data[]Rß(RBRRñ(RR((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR,s (RRR≠RRRüRõR†R,(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRшs    t S3MNoteInfocBs;eZdZeddfedfedfedffZRS(sá 0=end of row &31=channel &32=follows; BYTE:note, BYTE:instrument &64=follows; BYTE:volume &128=follows; BYTE:command, BYTE:info Rcithas_notet has_volumet has_effect(RRRXRRRA(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRªs    t PTMNoteInfocBs5eZeddfedfedfedffZRS(RciRºRæRΩ(RRRRRA(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRø%s   tNotecBseZdÑZRS(ccsó|i|dÉ}|V|dio t|dÉVt|dÉVn|diot|dÉVn|dio t|dÉVt|d ÉVndS( NR/Rºtnotet instrumentRΩRuRæteffecttparam(t NOTE_INFORBR(RR/((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRH.s(RRRH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR¿-stS3MNotecBseZeZRS((RRRªR≈(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR∆;stPTMNotecBseZeZRS((RRRøR≈(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR«=stRowcBseZdÑZRS(ccsx|i}xhto`|ii|d|iÉ}|pt|ddÉVdS|i|dÉ}|V||i7}q WdS(Nit terminatorisnote[](RSR#RÖRÜtendianR tNOTER(RRãtbyteR¡((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRHAs (RRRH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR»@stS3MRowcBseZeZRS((RRR∆RÀ(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRÕNstPTMRowcBseZeZRS((RRR«RÀ(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRŒPstPatterncBseZdÑZRS(ccsEd}x8|djo*|i o|i|dÉV|d7}q WdS(Nii@srow[]i(teoftROW(RR3((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRWTs (RRRW(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRœSsRÄcBseZeZddÑZRS(cCsKti|||||É|i}|ii|dtÉ}|i|ÉdS(Ni(RœRRSRÖRÜRRO(RRPRRRQRã((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR\s N(RRRÕR—RR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRÄZsRâcBseZeZRS((RRRŒR—(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRâdstModulecBs eZeZdÑZdÑZRS(cCsi|iiddtÉ}|djo d|S|iid dÉ}||ijod||ifStS( NiiisInvalid start marker %ui,isInvalid marker %s!=%si‡i`(RÖRÜRt readBytestMARKERR#(RRû((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pytvalidateks  ccsKtÉ}|it|idddÉÉx|i|ÉD] }|Vq8WdS(NtheaderiiP(R R+RtHEADERR7(RtindexerR5((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRHts  (RRRR R’RH(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR“gs t S3MModulecBsDeZhdd6dd6dd6dd6dd 6d d 6Zd ZeZRS(ts3mtidtaudiotcategorytfile_extu audio/s3mu audio/x-s3mtmimei@itmin_sizesScreamTracker3 moduleRítSCRM(R⁄(u audio/s3mu audio/x-s3mi(RRt PARSER_TAGSR‘RkR◊(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyRŸ}s t PTMModulecBs=eZhdd6dd6d d6d d6dd 6Zd ZeZRS( tptmR€R‹R›Rfii@iR‡sPolyTracker module (v1.17)RítPTMF(R‰i(RRR‚R‘RÅR◊(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyR„ìs N(((:RXthachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R RRthachoir_core.endianRthachoir_core.text_handlerRRthachoir_core.toolsRRR R8RDRERJRMRYRkRÅRçRëRîRñRóRRÆRÑRªRøR¿R∆R«R»RÕRŒRœRÄRâR“RŸR„(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/audio/s3m.pyt<module> sJd M  -$a6 3  
30,479
Python
.py
145
207.234483
1,800
0.431501
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,626
iso9660.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/iso9660.pyc
—Ú Œ »Mc@sfidZddklZddklZlZlZlZlZl Z l Z l Z l Z ddk lZlZdefdÑÉYZdefdÑÉYZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZdS(sƒ ISO 9660 (cdrom) file system parser. Documents: - Standard ECMA-119 (december 1987) http://www.nondot.org/sabre/os/files/FileSystems/iso9660.pdf Author: Victor Stinner Creation: 11 july 2006 iˇˇˇˇ(tParser( tFieldSett ParserErrortUInt8tUInt32tUInt64tEnumt NullBytestRawBytestString(t LITTLE_ENDIANt BIG_ENDIANtPrimaryVolumeDescriptorcBseZdZdÑZRS(i˘iccs}t|ddÉVt|dddddÉVt|ddd ddÉVt|dd ÉVt|d d ÉVt|ddÉVt|d dÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|dddÉVt|d d!d"ddÉVt|d#d!d$ddÉVt|d%d!d&ddÉVt|d'd!d(ddÉVt|d)d*d+ddÉVt|d,d*d-ddÉVt|d.d*d/ddÉVt|d0d1d2ddÉVt|d3d1d4ddÉVt|d5d1d6ddÉVt|d7d1d8ddÉVt|d9d:ÉVt|ddÉVt|d;d<d=ÉVt|dd>ÉVdS(?Nsunused[]it system_idi sSystem identifiertstript t volume_idsVolume identifierit space_sizesVolume space sizetset_sizesVolume set sizetseq_numsSequence numbert block_sizes Block sizetpath_table_sizesPath table sizet occu_lpaths+Location of Occurrence of Type L Path Tablet opt_lpaths)Location of Optional of Type L Path Tablet occu_mpaths+Location of Occurrence of Type M Path Tablet opt_mpaths)Location of Optional of Type M Path Tabletrooti"s#Directory Record for Root Directoryt vol_set_idiÄsVolume set identifiert publishersPublisher identifiert data_preparersData preparer identifiert applicationsApplication identifiert copyrighti%sCopyright file identifiertabstractsAbstract file identifiert biographicsBiographic file identifiert creation_tsisCreation date and timetmodification_tssModification date and timet expiration_tssExpiration date and timet effective_tssEffective date and timet struct_versStructure versiontapp_useisApplication useiç(RR RRRR(tself((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyt createFieldss<i»?(t__name__t __module__t static_sizeR)(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR st BootRecordcBseZdZdÑZRS(i˘iccsLt|dddddÉVt|dddddÉVt|dd d ÉVdS( Ntsys_idisBoot system identifierRttboot_idsBoot identifiert system_useiªsBoot system use(R R(R(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR)6si»?(R*R+R,R)(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR-4st TerminatorcBseZdZdÑZRS(i˘iccst|ddÉVdS(Ntnulli˘(R(R(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR)=si»?(R*R+R,R)(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR2;stVolumecBsgeZeZdZhdd6dd6dd6dd6d e6Zd Zhed6ed6e e6Z d ÑZ RS(iˇs Boot RecordisPrimary Volume DescriptorisSupplementary Volume DescriptorisVolume Partition Descriptoris Volume Descriptor Set Terminatoriiccs∞tt|ddÉ|iÉVt|dddÉV|didjotdÉÇnt|dd ÉV|ii|didÉ}|o||d ÉVnt|d dÉVdS(NttypesVolume descriptor typet signatureisISO 9960 signature (CD001)tCD001s!Invalid ISO 9960 volume signaturetversionsVolume descriptor versiontcontentt raw_contentiii˘( RRt type_nameRtvalueRtcontent_handlertgettNone(R(tcls((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR)Qsi@( R*R+R tendiant TERMINATORR;R,R-R R2R=R)(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR4@s  tISO9660cBsjeZeZdZdZhdd6dd6dd6edd d 6eed ffd 6Zd ÑZd ÑZRS(sCD001iÄtiso9660tidt file_systemtcategorysISO 9660 file systemt descriptioniitmin_sizetmagiccCs8|ii|idt|iÉÉ|ijodStS(NisInvalid signature(tstreamt readBytest NULL_BYTEStlentMAGICtTrue(R(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pytvalidateis/ccsÖ|i|idtÉVx<to4t|dÉ}|V|ditijoPqqW|i|ijo|i|idÉVndS(NR3svolume[]R5tend( tseekByteRMRPR4R<RBt current_sizet_sizetseekBit(R(tvolume((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyR)ns ( R*R+R RARORMt PARSER_TAGSRQR)(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyRC]s N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR thachoir_core.endianR R R R-R2R4RC(((sL/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/iso9660.pyt<module> s@"
6,656
Python
.py
38
174.026316
680
0.513979
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,627
ntfs.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/ntfs.pyc
—Ú Œ »Mc @sTdZdZddklZddklZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZddklZddklZlZlZddklZlZddklZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZ defdÑÉYZ!defdÑÉYZ"defdÑÉYZ#dS(s⁄ New Technology File System (NTFS) file system parser. Sources: - The NTFS documentation http://www.linux-ntfs.org/ - NTFS-3G driver http://www.ntfs-3g.org/ Creation date: 3rd january 2007 Author: Victor Stinner iiˇˇˇˇ(tParser(tFieldSettEnumtUInt8tUInt16tUInt32tUInt64tTimestampWin64tStringtBytestBittNullBitst NullBytest PaddingBytestRawBytes(t LITTLE_ENDIAN(t textHandlert hexadecimaltfilesizeHandler(t humanFilesizet createDict(tMSDOSFileAttr32tBiosParameterBlockcBs3eZdZdZhdd6ZdÑZdÑZRS(s. BIOS parameter block (bpb) structure iis Hard diski¯ccs–t|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d dÉVt|d dÉVtt|d É|iÉVt|d dÉVt|d ÉVt|dÉVt|dÉVt|ddÉVdS(Ntbytes_per_sectorsSize of a sector in bytestsectors_per_clustersSize of a cluster in sectorstreserved_sectorsitfatsit root_entriestsectorst media_typetsectors_per_fattsectors_per_tracktheadsthidden_sectorst large_sectorsi(RRR Rt MEDIA_TYPER(tself((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyt createFields!sc CsL|didjod|diS|didjod|diSdS(NRiiiiisInvalid sector size (%u bytes)Riiiiii i@iÄs!Invalid cluster size (%u sectors)t(iiiii(iiiiii i@iÄ(tvalue(R$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pytvalidate/s  i»(t__name__t __module__t__doc__t static_sizeR#R%R((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyRs   tMasterBootRecordcBs eZdZdÑZdÑZRS(iiccsZt|dddÉVt|ddÉVt|ddÉVtt|dd ÉtÉVt|d d ÉVtt|d d ÉtÉVt|dd ÉVt|dÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVtt|dÉtÉVtt|ddÉtÉVt|ddÉVt|ddd ÉVdS(!NtjumpisIntel x86 jump instructiontnameitbiossBIOS parameterstphysical_drives(0x80)t current_headit ext_boot_sigsExtended boot signature (0x80)tunusedt nb_sectorst mft_clustersCluster location of MFT datatmftmirr_clustersCluster location of copy of MFTtcluster_per_mftsMFT record size in clusterss reserved[]tcluster_per_indexsIndex block size in clusterst serial_numbertchecksumsBoot sector checksumt boot_codei™t mbr_magicis*Master boot record magic number (\x55\xAA)( R RRRRRR RR(R$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR%:s$cCs&|di|di}dt|ÉS(NR5sbios/bytes_per_sectorsNTFS Master Boot Record (%s)(R'R(R$tsize((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pytcreateDescriptionPsi(R)R*R,R%R?(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR-8s t MFT_FlagscBseZdZdÑZRS(iccs1t|dÉVt|dÉVt|ddÉVdS(Ntin_uset is_directorytpaddingi(R R (R$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR%Vs(R)R*R,R%(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR@Tst AttributecBs eZdÑZdÑZdÑZhdd6dd6dd6d d 6Zd ÑZd ÑZd ÑZdÑZ hddefd6dDd6ddefd6dEd6dFd6dGd6dHd"6dId%6d&d'efd(6dJd+6dKd.6d/d0e fd16dLd46dMd46dNd96dOd<6dPd?6dQdB6Z e e dÉZ RS(RcGsqti||å|did|_|di}||ijo,|i|d|_|i|d|_ndS(NR>ittypeii(Rt__init__R't_sizet ATTR_INFOt_namet_parser(R$targsRE((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyRF]s  ccsTttt|dÉtÉ|iÉVt|dÉVt|ddÉVt|ddÉVt|ddÉVt|d ÉVtt|d ÉtÉVt|d d ÉVt|d dÉVt|dÉVt|ddÉV|io#xI|i|ÉD] }|Vq‰Wn*|d i }|ot |d|ÉVn|i |i d}|ot |d|ÉVndS(NRER>t non_residentsNon-resident flagt name_lengthsName length in bytest name_offsets Name offsettflagst attribute_idt length_attrsLength of the Attributet offset_attrsOffset of the Attributet indexed_flagRCitdatait end_padding(RRRRt ATTR_NAMERRR RJR'RR>t current_sizeR (R$tfieldR>((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR%es*#   cCsd|diS(Ns Attribute %sRE(tdisplay(R$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR?|stPOSIXitWin32itDOSis Win32 & DOSiccsÕt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d ÉVt|d d ÉVt|d dÉVt|dÉVt|dÉVt|dÉVtt|ddÉÉVt|ddÉVdS(Ntctimes File Creationtatimes File Alteredtmtimes MFT Changedtrtimes File Readt file_attrsDOS File Permissionst max_versionsMaximum Number of VersionstversionsVersion Numbertclass_idtowner_idt security_idt quota_chargeds Quota ChargedtusnsUpdate Sequence Number (USN)(RRRRR(R$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pytparseStandardInfoÜsccst|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d ÉVtt|d d ÉÉVtt|d dÉÉVt|dÉVt|ddÉVt|ddÉVtt|dÉ|iÉV|did}|ot|d|ddÉVndS(Ntrefs&File reference to the parent directoryR]s File CreationR^s File AlteredR_s MFT ChangedR`s File Readt alloc_sizesAllocated size of the filet real_sizesReal size of the filet file_flagst file_flags2sUsed by EAs and Reparsetfilename_lengthsFilename length in characterstfilename_namespaceitfilenametcharsets UTF-16-LE( RRRRRRtFILENAME_NAMESPACER'R(R$R>((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyt parseFilenameîsccs4|i|id}|ot|d|ÉVndS(NiRT(R>RWR (R$R>((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyt parseData§sccs9|i|i}x"t|ÉD]}t|dÉVqWdS(Nsbit[](R>RWtxrangeR (R$R>tindex((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyt parseBitmap©s t standard_infosSTANDARD_INFORMATION it attr_listsATTRIBUTE_LIST i Rqs FILE_NAME i0tvol_vertVOLUME_VERSIONi@tobj_ids OBJECT_ID tsecuritysSECURITY_DESCRIPTOR iPtvol_names VOLUME_NAME i`tvol_infosVOLUME_INFORMATION ipRTsDATA iÄt index_roots INDEX_ROOT iêt index_allocsINDEX_ALLOCATION i†tbitmapsBITMAP i∞tsym_linkt SYMBOLIC_LINKi¿treparsesREPARSE_POINT tea_infosEA_INFORMATION i–teasEA i‡tprop_sett PROPERTY_SETitlog_utiltLOGGED_UTILITY_STREAMiN(RzsATTRIBUTE_LIST N(R{R|N(R}s OBJECT_ID N(R~sSECURITY_DESCRIPTOR N(Rs VOLUME_NAME N(RÄsVOLUME_INFORMATION N(RÅs INDEX_ROOT N(RÇsINDEX_ALLOCATION N(RÑRÖN(RÜsREPARSE_POINT N(RásEA_INFORMATION N(RàsEA N(RâRäN(RãRåN(R)R*RFR%R?RsRiRtRuRxtNoneRHRRV(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyRD[s@         tFilecBs#eZdÑZdÑZdÑZRS(cGs(ti||å|did|_dS(Ntbytes_allocatedi(RRFR'RG(R$RK((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyRF«sccs·t|dddÉVt|ddÉVt|ddÉVt|dd ÉVt|d d ÉVt|d d ÉVt|ddÉVt|dÉVt|ddÉVt|ddÉVt|dÉVt|dÉVt|ddÉVt|ddÉV|i|didtÉ}|o |Vnx_|i pT|i |i }|i i |dÉdjot|ddÉVPnt|dÉVqW|di|i d}|ot|d |ÉVn|i|i d}|ot|d!|d"ÉVndS(#Nt signatureisUsually the magic is 'FILE'tusa_ofssUpdate Sequence Array offsett usa_countsUpdate Sequence Array counttlsns($LogFile sequence number for this recordtsequence_numbers/Number of times this mft record has been reusedt link_countsNumber of hard linkst attrs_offsets"Byte offset to the first attributeROt bytes_in_uses#Number of bytes used in this recordRès)Number of bytes allocated for this recordtbase_mft_recordtnext_attr_instancetreserveditmft_record_numbersNumber of this mft recordtrelativesˇˇˇˇtattr_end_markerisattr[]t end_rawdataRUsUnused but allocated bytes(R RRR@RR tseekByteR'tTrueteoftabsolute_addressRWtstreamt readBytesRDRR>(R$RCtaddrR>((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR%Às<  cCs|d}d|jo|d|di7}nd|jo|d|di7}nd|jo|d|di7}n|S(NRésfilename/filenames "%s"sfilename/real_sizes (%s)sstandard_info/file_attrs, %s(R'RY(R$ttext((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR?s   (R)R*RFR%R?(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyRé≈s  %tNTFScBs^eZdZhdd6dd6dd6dd 6ed ffd 6ZeZdZd ÑZd ÑZ RS(s ÎRêNTFS tntfstidt file_systemtcategorysNTFS file systemt descriptioniitmin_sizeitmagiccCsM|iidt|iÉÉ|ijodS|diÉ}|o|StS(NisInvalid magic stringsmbr/bios(R£R§tlentMAGICR(R†(R$terr((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR(s (ccsøt|dÉV|d}|di|di}|di|}|i|dtÉ}|o |Vnx"tdÉD]}t|dÉVqsW|i|id }|ot|d |ÉVndS( Ntmbrsmbr/biosRRsmbr/mft_clusterRúiËsfile[]itend( R-R'RütFalseRvRéR>RWR(R$R0t cluster_sizetoffsetRCRwR>((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyR%s   i N( R)R*R∞t PARSER_TAGSRtendianRçt _cluster_sizeR(R%(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyRß˙s N($R+t SECTOR_SIZEthachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R Rthachoir_core.endianRthachoir_core.text_handlerRRRthachoir_core.toolsRRthachoir_parser.common.msdosRRR-R@RDRéRß(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ntfs.pyt<module> s^j5
14,197
Python
.py
50
282.66
1,039
0.478298
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,628
linux_swap.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/linux_swap.pyc
Ñò Î ÈMc@sØdZddklZddklZlZlZlZlZl Z l Z ddk l Z ddk lZddklZdZedd d Zd e fd „ƒYZd efd„ƒYZdefd„ƒYZdS(s´ Linux swap file. Documentation: Linux kernel source code, files: - mm/swapfile.c - include/linux/swap.h Author: Victor Stinner Creation date: 25 december 2006 (christmas ;-)) iÿÿÿÿ(tParser(t ParserErrort GenericVectortUInt32tStringtBytest NullBytestRawBytes(t LITTLE_ENDIAN(t humanFilesize(tstr2hexii iitPagecBseZedZd„ZRS(icCsti|||tƒdS(N(Rt__init__t PAGE_SIZE(tselftparenttname((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyR s(t__name__t __module__R t static_sizeR (((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyR s tUUIDcBs eZdZd„Zd„ZRS(iicCsti|||dƒdS(Ni(RR (RRR((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyR !sc CsIt|iddƒ}d|d |dd!|dd!|dd!|dfS(Ntformats%02xs%s-%s-%s-%s-%sii ii(R tvalue(Rttext((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyt createDisplay#si€(RRRR R(((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyRs t LinuxSwapFilecBs™eZhdd6dd6dd6edd6dd 6d ed dfd ed dfd ed dffd6ZeZd„Zd„Zd„Zd„Z RS(t linux_swaptidttfile_extt file_systemtcategoryitmin_sizesLinux swap filet descriptions SWAP-SPACEi t SWAPSPACE2t S1SUSPENDtmagiccCsW|iitdddƒ}|d jodSt|dijod|diStS( Ni is SWAP-SPACER"R#sUnknown magic stringt nb_badpagesInvalid number of bad page (%u)(s SWAP-SPACER"R#(tstreamt readBytesR tMAX_SWAP_BADPAGESRtTrue(RR$((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pytvalidate7s  cCs|di|didS(s” Number of pages which can really be used for swapping: number of page minus bad pages minus one page (used for the header) t last_pageR%i(R(R((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyt getPageCount?scCse|didjo d}n%|didjo d}nd}|iƒ}d|ttƒ|fS(NR$R#sSuspend swap file version 1R"sLinux swap file version 2sLinux swap file version 1s%s, page size: %s, %s pages(RR,R R (RRtnb_page((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pytcreateDescriptionGs   ccsKt|dddƒVt|dƒVt|dƒVt|dƒVt|dƒVt|dƒVt|d dƒV|di}|o<t|jotd |ƒ‚nt|d |tdƒVn|it dddt ƒ}|o |Vnt |ddddƒVt|d|dit dƒV|i |iddt ƒ}|o |VndS(NtbootisSpace for disklabel etc.tversionR+R%tsws_uuidt sws_volumetreservediuisInvalid number of bad page (%u)tbadpagestbadpagei tpaddingtnullR$tcharsettASCIItpagestpaget end_paddingiÔ(RRRRRR(RRtseekByteR R)RR tseekBittsize(RtcountR6((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyt createFieldsRs(   (R( RRR t PARSER_TAGSRtendianR*R,R.RA(((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyR(s    N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRthachoir_core.endianRthachoir_core.toolsR thachoir_core.bitsR R R(R RR(((sO/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/linux_swap.pyt<module> s4
5,049
Python
.py
42
118.52381
449
0.47503
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,629
fat.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/fat.pyc
—Ú Œ »Mc @s&ddklZddklZddklZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZlZddklZddklZddklZlZddklZddklZlZdd k Z dd k!Z!e!i"d ÉZ#d efd ÑÉYZ$d efdÑÉYZ%defdÑÉYZ&defdÑÉYZ'de fdÑÉYZ(defdÑÉYZ)de fdÑÉYZ*de fdÑÉYZ+dd%dÑÉYZ,defdÑÉYZ-de-fd ÑÉYZ.d!e-fd"ÑÉYZ/d#e-fd$ÑÉYZ0d S(&iˇˇˇˇ(tsorted(tParser(tFieldSettStaticFieldSettRawBytest PaddingBytestcreatePaddingFieldtLinktFragmenttBittBitstUInt8tUInt16tUInt32tStringtBytest NullBytes(tGenericInteger(t LITTLE_ENDIAN(t textHandlert hexadecimal(terror(t humanFilesizet makePrintableNs \[[^]]+]$tBootcBseZdZdÑZRS(iic csLt|dddÉVt|dddÉVt|ddÉVt|d d ÉVt|d d ÉVt|d dÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉV|iidjo~t|d dÉVt|d!d"ÉVt|d#d$ÉVt|d%d&ÉVt|d'd(ÉVt|d)d*ÉVt|d+d,d-ÉVnt|d.d/ÉVt|d+d0d1ÉVt|d2d3ÉVtt|d4d5ÉtÉVt |d6d7d8d9d:d;d<ÉVt |d=dd>d9d:d;d<ÉVt|d?d@|i ddAÉVt|dBdCdDÉVdS(ENtjmpis.Jump instruction (to skip over header on boot)toem_nameisOEM Name (padded with spaces)t sector_sizesBytes per sectort cluster_sizesSectors per clustertreserved_sectorss-Reserved sector count (including boot sector)tfat_nbs Number of file allocation tablestmax_roots(Maximum number of root directory entriestsectors1s'Total sectors (if zero, use 'sectors2')t media_descsMedia descriptortfat_sizesSectors per FATt track_sizesSectors per trackthead_nbsNumber of headsthiddensHidden sectorstsectors2s%Total sectors (if greater than 65535)i t fat32_sizet fat_flagss FAT FlagstversiontVersiont root_starts&Cluster number of root directory startt inf_sectors&Sector number of FS Information Sectort boot_copys+Sector number of a copy of this boot sectors reserved[]i tReservedtphys_drvsPhysical drive numberisReserved ("current head")tsignt SignaturetserialsID (serial number)tlabeli s Volume Labeltstript tcharsettASCIItfs_typesFAT file system typetcodei˛sOperating system boot codet trail_sigisSignature (0x55 0xAA)( RR R R tparentR)RRRRt current_size(tself((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt createFieldss<  i(t__name__t __module__t static_sizeR>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRstFSInfoc BsheZedddfeddfedddfeddfed fedd fed dd ffZRS( tlead_sigisSignature ("RRaA")s reserved[]i‡t struct_sigsSignature ("rrAa")t free_counts+Last known free cluster count on the volumetnxt_freei R:sSignature (0x00 0x00 0x55 0xAA)(R?R@RRR Rtformat(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRB5s    tFATcBs'eZdefdÑÉYZdÑZRS(RHcBseZdÑZRS(ccsZ|i}|ii}|i}x5|i|ijo!tt|dt|É|ÉVq!WdS(Nsentry[](R;R)t text_handlerR<t_sizeRRtFalse(R=R;R)RI((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR>Cs    (R?R@R>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRHBsc #sÑ|ii}dtd|É>âáfdÜ}||_xF|i|ijo2ti|ddtd||i|iÉÉVq:WdS(Niics|i}d|à}|djodS|djodS|djodS|djodS|djod St|ÉSdS( Niisreserved clusters free clusteri send of a chains bad clusterisreserved value(tvaluetstr(tchunktitj(t max_entry(sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pytFatEntryLs      sgroup[]tsizeiË(R;R)tminRIR<RJRH(R=R)RR((RQsH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR>Is  (R?R@RRHR>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRHAstDatecBs#eZdÑZdÑZdÑZRS(cCs:ti|||dhdd6dd6dd6|dÉdS( NRSitcreateitaccessitmodifyi(Rt__init__(R=R;tname((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRYas ccsº|id}|djob|djot|ddÉVnt|dddÉVt|d d d ÉVt|d dd ÉVnt|dddÉVt|dddÉVt|dddÉVdS(Niiitcss 10ms units, values from 0 to 199t2secis seconds/2RTitminutesthourthourstdays(1-31)tmonths(1-12)tyearis(0 = 1980, 127 = 2107)(RSR R (R=RS((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR>hs   cCs0|di|di|dig}|id}|djopti}d|di}|djo||d i7}n||d i|d i|d |d d g7}n ti}|g}|D] }|dq≈~jo d}n>|dcd7<y|t|Éå}Wntj odSXt|ÉS(NRbRaR`iii»R\iR[R^RTidi'iiºtinvalid(RLRStdatetimetdatetNonettuplet ValueErrorRM(R=ReRStmkdateR[t_[1]RO((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pytcreateDescriptionts"$    4 ( (R?R@RYR>Rk(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRU`s  t InodeLinkcBs/eZddÑZdÑZdÑZdÑZRS(cCs)ti|||É||_d|_dS(N(RRYttargetRftfirst(R=R;RZRm((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRYãs cCsL|ip;|i}tid|iiÉ|iÉidÉ|_n|iS(Ns\\t/(RmR;t strip_indextsubt_namet getFilenametrstrip(R=R;((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt_getTargetPathês  2cCsJt|d|i|iÉÉ|É}|o|i|_ti|ÉSdS(NRo(tInodeGenR;Rutpatht_displayRt createValue(R=tfield((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRyñs% cCsd|iÉS(Ns/%s[0](Ru(R=((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt createDisplayúsN(R?R@RfRYRuRyR{(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRläs   t FileEntrycBsGeZdZeZeZdÑZdÑZdÑZdÑZ dÑZ RS(i icGs§ti||å|ii|idtÉ|_|id jodS|ii|id dtÉ}|d@djo t|_n!|i Éd jo t|_ ndS( NiiiÂi i?it.s..(iiÂiX(R}s..( RRYtstreamtreadBitstabsolute_addressRtstatustTruetLFNRstprocess(R=targstmagic((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRY•s cCs™|di}t|tÉot|ddtÉ}n|di}|o|d|7}n|ddjod|d }n|i o|d io|d 7}n|S( NRZR7t to_unicodetextR}iisÂit directoryRo(RLt isinstanceRMRRÇRÉ(R=RZRà((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRs±s  cCs±|idjodS|idjodS|iokdidÑ|idÉDÉÉ}y||idÉ }Wntj onX|d i}d ||fSd |iÉSdS( Nis Free entryiÂs Deleted filetcssx|]}|iVqWdS(N(RL(t.0Rz((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pys <genexpr>ƒs RZttseq_nosLong filename part: '%s' [%u]s File: '%s'(RÅRÉtjointarraytindexRhRLRs(R=RZRé((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRkæs " cCs@|di}|iiidjo||did>7}n|S(Nt cluster_loit cluster_hi(RLR;R)(R=tcluster((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt getClusterŒs c csr|ipæt|dddddddÉVt|dd d ddddÉVt|d ÉVt|d ÉVt|d ÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dddÉVt|dÉVt|dÉV|iiidjot|dÉVnt|dÉVt|dÉVt|dÉVt|dÉ}|V|i oj|` |i }|di o"|o|i dÉd}q•n |pdSd||_ t |d ÉVqnnßt|d!d"ÉVt|d#d$d%dd&ÉVt|d'd(ÉVt|ddd)ÉVt|d*d+ÉVt|d#d,d-dd&ÉVt|d.d)ÉVt|d#d/d0dd&ÉVdS(1NRZis"DOS file name (padded with spaces)R4R5R6R7Ràis'DOS file extension (padded with spaces)t read_onlyR%tsystemt volume_labelRâtarchivetdevicetunusedtreservedisSomething about the caseRVRWiRìtea_indexRXRíRSs(FAT) value must be zeroitdataRésSequence Numbersname[]i s(5 UTF-16 characters)s UTF-16-LERÜsMagic number (15)s (always 0)tchecksumsChecksum of DOS file namei s(6 UTF-16 characters)t first_clusteris(2 UTF-16 characters)(RÉRR RRUR;R)R R RÑRLRt target_sizeRlR R(R=RSR°((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR>‘sZ     i( R?R@RARKRÑRÉRYRsRkRïR>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR|†s  t DirectorycBseZdÑZRS(ccs-x&|i|ijot|dÉVqWdS(Nsentry[](R<RJR|(R=((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR>s(R?R@R>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR¢stFilecBseZdÑZdÑZRS(cCs|dS(NRû((R=((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt_getData sccsEt|d|idÉV|i|i}|ot||ÉVndS(NRûi(RtdatasizeRJR<R(R=tpadding((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR> s(R?R@R§R>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR£ s RvcBseZdÑZdÑZRS(cs[|à_|iàiÉà_|à_àià_dà_ááfdÜ}|à_dS(Nics<ài|d<|idgÉidàiÉfÉ||çS(NRSttagstfilename(tfilesizet setdefaulttappendRs(tcisRÖ(tentryR=(sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pytcreateInputStreams %( troottclustersRïRîRwR°R©tdoneRÆ(R=RØR≠RwRÆ((R≠R=sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRYs    csåàid}àiiÉ\}}}àio±àiàijotdàiÉdStài|d|Éâ|idjo.dt àidÉà_ ài ài Éntàiài|Éà_àiài7_ntài|d|Éâàii|dtÉ}t|ttfÉptd|ÉdS|o d}nááfdÜ}ài|i|Éàii||àfÉàS( Ns[]s(FAT) bad metadata for RSs File size: %sitfeeds1(FAT) address %u doesn't point to a padding fieldcs ààÉS((((RzR=(sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt<lambda>6s(RwRîtnextR©R±RR£RØRnRfRt _descriptiont setSubIStreamRÆRTR•R¢tgetFieldByAddressRKRäRRtsetLinkst writeFieldsIn(R=tprevRZtaddressRStlastR¶R¥((R=RzsH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt__call__ s.   (R?R@RYRΩ(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRvs tFAT_FScBsDeZeZhdd6d d6d d6ZdÑZdÑZd ÑZRS( t file_systemtcategoryiitmin_sizeRãtfile_extcCsX|ii|ddÉd|ijo d|iS|iiddÉdjodStS( NisFAT%-5usInvalid FAT%u signaturei˛isU™sInvalid BIOS signaturei(R~t readBytesR)RÇ(R=t type_offset((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt _validateDs ' ccsdtd|iÉ>d}|É}d|jo |jnoœd}|}xôtoë|i|d|di}d|jo |jnpPn|||jo|d7}qP|i||i||itfV|}d}qPW|i||i||itfVndS(NiiiiË(RTR)RÇtfatRLt data_startRRK(R=t cluster_funcRQRîtclus_nbR¥((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR∞Ks  # c #stàddÉâàVàdià_àidjoíxètàdiáfdÜfàdiáfdÜffÉD]K}|d o:ài|d àiÉ}|o |Vn|d ÉVqvqvWnàiàd iàiÉ}|o |Vnàd i}|d joàd i}n|àid9}x2tàdiÉD]}tàddd|ÉVqFWàdiàidà_àdà_ dàjo0d à_ áfdÜà_ t àddÉVn$t àddàdiddÉVàidàià_àdi}|pàdi}n|ài}àiot|àidÉ}nài|É}|o |VndS(Ntboots Boot sectorRi R,cs tàdÉS(tfsinfo(RB((R=(sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR≥esR-cstàddÉS(tbkbootsCopy of the boot sector(R((R=(sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR≥fsiiRR"R'iRsfat[]sFile Allocation TableRSRsfat[0]R+cs àdiS(R+(RL((R (sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR≥~sRØsroot[]RiR R&(RRLRR)RtseekBytetxrangeRHRR∆R°RïRlR¢R<R«RJRTRS(R=RzR¶R"ROtsectorsRS((R R=sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR>]sP         #   i(Rã(R?R@Rtendiant PARSER_TAGSR≈R∞R>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRæ<s   tFAT12cBs;eZhdd6dd6dd ffd6ZdZd ÑZRS( tfat12tidsFAT12 filesystemt descriptionsFAT12 i6iRÜi cCsti|dÉS(Ni6(RæR≈(R=((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pytvalidateòsi∞(R?R@R—R)R÷(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR“ês tFAT16cBs;eZhdd6dd6dd ffd6ZdZd ÑZRS( tfat16R‘sFAT16 filesystemR’sFAT16 i6iRÜicCsti|dÉS(Ni6(RæR≈(R=((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR÷§si∞(R?R@R—R)R÷(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR◊ús tFAT32cBs;eZhdd6dd6dd ffd6ZdZd ÑZRS( tfat32R‘sFAT32 filesystemR’sFAT32 iRiRÜi cCsti|dÉS(NiR(RæR≈(R=((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyR÷∞siê(R?R@R—R)R÷(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyRŸ®s ((1thachoir_core.compatibilityRthachoir_parserRthachoir_core.fieldRRRRRRRR R R R R RRRthachoir_core.field.integerRthachoir_core.endianRthachoir_core.text_handlerRRthachoir_core.errorRthachoir_core.toolsRRRdtretcompileRpRRBRHRURlR|R¢R£RvRæR“R◊RŸ(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/fat.pyt<module>s.d  # *e )T 
20,647
Python
.py
73
281.821918
1,286
0.43548
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,630
__init__.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/__init__.pyc
Ñò Î ÈMc @s€ddklZddklZlZlZddklZddkl Z ddk l Z ddk l Z ddklZdS( iÿÿÿÿ(tEXT2_FS(tFAT12tFAT16tFAT32(tMSDos_HardDrive(tNTFS(tISO9660(t REISER_FS(t LinuxSwapFileN(thachoir_parser.file_system.ext2Rthachoir_parser.file_system.fatRRRthachoir_parser.file_system.mbrRthachoir_parser.file_system.ntfsRt"hachoir_parser.file_system.iso9660Rt$hachoir_parser.file_system.reiser_fsRt%hachoir_parser.file_system.linux_swapR(((sM/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/__init__.pyt<module>s 
764
Python
.py
3
253.666667
650
0.548556
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,631
linux_swap.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/linux_swap.py
""" Linux swap file. Documentation: Linux kernel source code, files: - mm/swapfile.c - include/linux/swap.h Author: Victor Stinner Creation date: 25 december 2006 (christmas ;-)) """ from hachoir_parser import Parser from hachoir_core.field import (ParserError, GenericVector, UInt32, String, Bytes, NullBytes, RawBytes) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.tools import humanFilesize from hachoir_core.bits import str2hex PAGE_SIZE = 4096 # Definition of MAX_SWAP_BADPAGES in Linux kernel: # (__swapoffset(magic.magic) - __swapoffset(info.badpages)) / sizeof(int) MAX_SWAP_BADPAGES = ((PAGE_SIZE - 10) - 1536) // 4 class Page(RawBytes): static_size = PAGE_SIZE*8 def __init__(self, parent, name): RawBytes.__init__(self, parent, name, PAGE_SIZE) class UUID(Bytes): static_size = 16*8 def __init__(self, parent, name): Bytes.__init__(self, parent, name, 16) def createDisplay(self): text = str2hex(self.value, format=r"%02x") return "%s-%s-%s-%s-%s" % ( text[:8], text[8:12], text[12:16], text[16:20], text[20:]) class LinuxSwapFile(Parser): PARSER_TAGS = { "id": "linux_swap", "file_ext": ("",), "category": "file_system", "min_size": PAGE_SIZE*8, "description": "Linux swap file", "magic": ( ("SWAP-SPACE", (PAGE_SIZE-10)*8), ("SWAPSPACE2", (PAGE_SIZE-10)*8), ("S1SUSPEND\0", (PAGE_SIZE-10)*8), ), } endian = LITTLE_ENDIAN def validate(self): magic = self.stream.readBytes((PAGE_SIZE-10)*8, 10) if magic not in ("SWAP-SPACE", "SWAPSPACE2", "S1SUSPEND\0"): return "Unknown magic string" if MAX_SWAP_BADPAGES < self["nb_badpage"].value: return "Invalid number of bad page (%u)" % self["nb_badpage"].value return True def getPageCount(self): """ Number of pages which can really be used for swapping: number of page minus bad pages minus one page (used for the header) """ # -1 because first page is used for the header return self["last_page"].value - self["nb_badpage"].value - 1 def createDescription(self): if self["magic"].value == "S1SUSPEND\0": text = "Suspend swap file version 1" elif self["magic"].value == "SWAPSPACE2": text = "Linux swap file version 2" else: text = "Linux swap file version 1" nb_page = self.getPageCount() return "%s, page size: %s, %s pages" % ( text, humanFilesize(PAGE_SIZE), nb_page) def createFields(self): # First kilobyte: boot sectors yield RawBytes(self, "boot", 1024, "Space for disklabel etc.") # Header yield UInt32(self, "version") yield UInt32(self, "last_page") yield UInt32(self, "nb_badpage") yield UUID(self, "sws_uuid") yield UUID(self, "sws_volume") yield NullBytes(self, "reserved", 117*4) # Read bad pages (if any) count = self["nb_badpage"].value if count: if MAX_SWAP_BADPAGES < count: raise ParserError("Invalid number of bad page (%u)" % count) yield GenericVector(self, "badpages", count, UInt32, "badpage") # Read magic padding = self.seekByte(PAGE_SIZE - 10, "padding", null=True) if padding: yield padding yield String(self, "magic", 10, charset="ASCII") # Read all pages yield GenericVector(self, "pages", self["last_page"].value, Page, "page") # Padding at the end padding = self.seekBit(self.size, "end_padding", null=True) if padding: yield padding
3,777
Python
.py
96
31.71875
81
0.608245
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,632
iso9660.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/iso9660.py
""" ISO 9660 (cdrom) file system parser. Documents: - Standard ECMA-119 (december 1987) http://www.nondot.org/sabre/os/files/FileSystems/iso9660.pdf Author: Victor Stinner Creation: 11 july 2006 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, UInt8, UInt32, UInt64, Enum, NullBytes, RawBytes, String) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN class PrimaryVolumeDescriptor(FieldSet): static_size = 2041*8 def createFields(self): yield NullBytes(self, "unused[]", 1) yield String(self, "system_id", 32, "System identifier", strip=" ") yield String(self, "volume_id", 32, "Volume identifier", strip=" ") yield RawBytes(self, "unused[]", 8) yield UInt64(self, "space_size", "Volume space size") yield RawBytes(self, "unused[]", 32) yield UInt32(self, "set_size", "Volume set size") yield UInt32(self, "seq_num", "Sequence number") yield UInt32(self, "block_size", "Block size") yield UInt64(self, "path_table_size", "Path table size") yield UInt32(self, "occu_lpath", "Location of Occurrence of Type L Path Table") yield UInt32(self, "opt_lpath", "Location of Optional of Type L Path Table") yield UInt32(self, "occu_mpath", "Location of Occurrence of Type M Path Table") yield UInt32(self, "opt_mpath", "Location of Optional of Type M Path Table") yield RawBytes(self, "root", 34, "Directory Record for Root Directory") yield String(self, "vol_set_id", 128, "Volume set identifier", strip=" ") yield String(self, "publisher", 128, "Publisher identifier", strip=" ") yield String(self, "data_preparer", 128, "Data preparer identifier", strip=" ") yield String(self, "application", 128, "Application identifier", strip=" ") yield String(self, "copyright", 37, "Copyright file identifier", strip=" ") yield String(self, "abstract", 37, "Abstract file identifier", strip=" ") yield String(self, "biographic", 37, "Biographic file identifier", strip=" ") yield String(self, "creation_ts", 17, "Creation date and time", strip=" ") yield String(self, "modification_ts", 17, "Modification date and time", strip=" ") yield String(self, "expiration_ts", 17, "Expiration date and time", strip=" ") yield String(self, "effective_ts", 17, "Effective date and time", strip=" ") yield UInt8(self, "struct_ver", "Structure version") yield NullBytes(self, "unused[]", 1) yield RawBytes(self, "app_use", 512, "Application use") yield NullBytes(self, "unused[]", 653) class BootRecord(FieldSet): static_size = 2041*8 def createFields(self): yield String(self, "sys_id", 31, "Boot system identifier", strip="\0") yield String(self, "boot_id", 31, "Boot identifier", strip="\0") yield RawBytes(self, "system_use", 1979, "Boot system use") class Terminator(FieldSet): static_size = 2041*8 def createFields(self): yield NullBytes(self, "null", 2041) class Volume(FieldSet): endian = BIG_ENDIAN TERMINATOR = 255 type_name = { 0: "Boot Record", 1: "Primary Volume Descriptor", 2: "Supplementary Volume Descriptor", 3: "Volume Partition Descriptor", TERMINATOR: "Volume Descriptor Set Terminator", } static_size = 2048 * 8 content_handler = { 0: BootRecord, 1: PrimaryVolumeDescriptor, TERMINATOR: Terminator, } def createFields(self): yield Enum(UInt8(self, "type", "Volume descriptor type"), self.type_name) yield RawBytes(self, "signature", 5, "ISO 9960 signature (CD001)") if self["signature"].value != "CD001": raise ParserError("Invalid ISO 9960 volume signature") yield UInt8(self, "version", "Volume descriptor version") cls = self.content_handler.get(self["type"].value, None) if cls: yield cls(self, "content") else: yield RawBytes(self, "raw_content", 2048-7) class ISO9660(Parser): endian = LITTLE_ENDIAN MAGIC = "\x01CD001" NULL_BYTES = 0x8000 PARSER_TAGS = { "id": "iso9660", "category": "file_system", "description": "ISO 9660 file system", "min_size": (NULL_BYTES + 6)*8, "magic": ((MAGIC, NULL_BYTES*8),), } def validate(self): if self.stream.readBytes(self.NULL_BYTES*8, len(self.MAGIC)) != self.MAGIC: return "Invalid signature" return True def createFields(self): yield self.seekByte(self.NULL_BYTES, null=True) while True: volume = Volume(self, "volume[]") yield volume if volume["type"].value == Volume.TERMINATOR: break if self.current_size < self._size: yield self.seekBit(self._size, "end")
4,941
Python
.py
107
38.71028
90
0.640041
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,633
ntfs.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/ntfs.py
""" New Technology File System (NTFS) file system parser. Sources: - The NTFS documentation http://www.linux-ntfs.org/ - NTFS-3G driver http://www.ntfs-3g.org/ Creation date: 3rd january 2007 Author: Victor Stinner """ SECTOR_SIZE = 512 from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Enum, UInt8, UInt16, UInt32, UInt64, TimestampWin64, String, Bytes, Bit, NullBits, NullBytes, PaddingBytes, RawBytes) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal, filesizeHandler from hachoir_core.tools import humanFilesize, createDict from hachoir_parser.common.msdos import MSDOSFileAttr32 class BiosParameterBlock(FieldSet): """ BIOS parameter block (bpb) structure """ static_size = 25 * 8 MEDIA_TYPE = {0xf8: "Hard disk"} def createFields(self): yield UInt16(self, "bytes_per_sector", "Size of a sector in bytes") yield UInt8(self, "sectors_per_cluster", "Size of a cluster in sectors") yield NullBytes(self, "reserved_sectors", 2) yield NullBytes(self, "fats", 1) yield NullBytes(self, "root_entries", 2) yield NullBytes(self, "sectors", 2) yield Enum(UInt8(self, "media_type"), self.MEDIA_TYPE) yield NullBytes(self, "sectors_per_fat", 2) yield UInt16(self, "sectors_per_track") yield UInt16(self, "heads") yield UInt32(self, "hidden_sectors") yield NullBytes(self, "large_sectors", 4) def validate(self): if self["bytes_per_sector"].value not in (256, 512, 1024, 2048, 4096): return "Invalid sector size (%u bytes)" % \ self["bytes_per_sector"].value if self["sectors_per_cluster"].value not in (1, 2, 4, 8, 16, 32, 64, 128): return "Invalid cluster size (%u sectors)" % \ self["sectors_per_cluster"].value return "" class MasterBootRecord(FieldSet): static_size = 512*8 def createFields(self): yield Bytes(self, "jump", 3, "Intel x86 jump instruction") yield String(self, "name", 8) yield BiosParameterBlock(self, "bios", "BIOS parameters") yield textHandler(UInt8(self, "physical_drive", "(0x80)"), hexadecimal) yield NullBytes(self, "current_head", 1) yield textHandler(UInt8(self, "ext_boot_sig", "Extended boot signature (0x80)"), hexadecimal) yield NullBytes(self, "unused", 1) yield UInt64(self, "nb_sectors") yield UInt64(self, "mft_cluster", "Cluster location of MFT data") yield UInt64(self, "mftmirr_cluster", "Cluster location of copy of MFT") yield UInt8(self, "cluster_per_mft", "MFT record size in clusters") yield NullBytes(self, "reserved[]", 3) yield UInt8(self, "cluster_per_index", "Index block size in clusters") yield NullBytes(self, "reserved[]", 3) yield textHandler(UInt64(self, "serial_number"), hexadecimal) yield textHandler(UInt32(self, "checksum", "Boot sector checksum"), hexadecimal) yield Bytes(self, "boot_code", 426) yield Bytes(self, "mbr_magic", 2, r"Master boot record magic number (\x55\xAA)") def createDescription(self): size = self["nb_sectors"].value * self["bios/bytes_per_sector"].value return "NTFS Master Boot Record (%s)" % humanFilesize(size) class MFT_Flags(FieldSet): static_size = 16 def createFields(self): yield Bit(self, "in_use") yield Bit(self, "is_directory") yield NullBits(self, "padding", 14) class Attribute(FieldSet): # --- Common code --- def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["size"].value * 8 type = self["type"].value if type in self.ATTR_INFO: self._name = self.ATTR_INFO[type][0] self._parser = self.ATTR_INFO[type][2] def createFields(self): yield Enum(textHandler(UInt32(self, "type"), hexadecimal), self.ATTR_NAME) yield UInt32(self, "size") yield UInt8(self, "non_resident", "Non-resident flag") yield UInt8(self, "name_length", "Name length in bytes") yield UInt16(self, "name_offset", "Name offset") yield UInt16(self, "flags") yield textHandler(UInt16(self, "attribute_id"), hexadecimal) yield UInt32(self, "length_attr", "Length of the Attribute") yield UInt16(self, "offset_attr", "Offset of the Attribute") yield UInt8(self, "indexed_flag") yield NullBytes(self, "padding", 1) if self._parser: for field in self._parser(self): yield field else: size = self["length_attr"].value if size: yield RawBytes(self, "data", size) size = (self.size - self.current_size) // 8 if size: yield PaddingBytes(self, "end_padding", size) def createDescription(self): return "Attribute %s" % self["type"].display FILENAME_NAMESPACE = { 0: "POSIX", 1: "Win32", 2: "DOS", 3: "Win32 & DOS", } # --- Parser specific to a type --- def parseStandardInfo(self): yield TimestampWin64(self, "ctime", "File Creation") yield TimestampWin64(self, "atime", "File Altered") yield TimestampWin64(self, "mtime", "MFT Changed") yield TimestampWin64(self, "rtime", "File Read") yield MSDOSFileAttr32(self, "file_attr", "DOS File Permissions") yield UInt32(self, "max_version", "Maximum Number of Versions") yield UInt32(self, "version", "Version Number") yield UInt32(self, "class_id") yield UInt32(self, "owner_id") yield UInt32(self, "security_id") yield filesizeHandler(UInt64(self, "quota_charged", "Quota Charged")) yield UInt64(self, "usn", "Update Sequence Number (USN)") def parseFilename(self): yield UInt64(self, "ref", "File reference to the parent directory") yield TimestampWin64(self, "ctime", "File Creation") yield TimestampWin64(self, "atime", "File Altered") yield TimestampWin64(self, "mtime", "MFT Changed") yield TimestampWin64(self, "rtime", "File Read") yield filesizeHandler(UInt64(self, "alloc_size", "Allocated size of the file")) yield filesizeHandler(UInt64(self, "real_size", "Real size of the file")) yield UInt32(self, "file_flags") yield UInt32(self, "file_flags2", "Used by EAs and Reparse") yield UInt8(self, "filename_length", "Filename length in characters") yield Enum(UInt8(self, "filename_namespace"), self.FILENAME_NAMESPACE) size = self["filename_length"].value * 2 if size: yield String(self, "filename", size, charset="UTF-16-LE") def parseData(self): size = (self.size - self.current_size) // 8 if size: yield Bytes(self, "data", size) def parseBitmap(self): size = (self.size - self.current_size) for index in xrange(size): yield Bit(self, "bit[]") # --- Type information --- ATTR_INFO = { 0x10: ('standard_info', 'STANDARD_INFORMATION ', parseStandardInfo), 0x20: ('attr_list', 'ATTRIBUTE_LIST ', None), 0x30: ('filename', 'FILE_NAME ', parseFilename), 0x40: ('vol_ver', 'VOLUME_VERSION', None), 0x40: ('obj_id', 'OBJECT_ID ', None), 0x50: ('security', 'SECURITY_DESCRIPTOR ', None), 0x60: ('vol_name', 'VOLUME_NAME ', None), 0x70: ('vol_info', 'VOLUME_INFORMATION ', None), 0x80: ('data', 'DATA ', parseData), 0x90: ('index_root', 'INDEX_ROOT ', None), 0xA0: ('index_alloc', 'INDEX_ALLOCATION ', None), 0xB0: ('bitmap', 'BITMAP ', parseBitmap), 0xC0: ('sym_link', 'SYMBOLIC_LINK', None), 0xC0: ('reparse', 'REPARSE_POINT ', None), 0xD0: ('ea_info', 'EA_INFORMATION ', None), 0xE0: ('ea', 'EA ', None), 0xF0: ('prop_set', 'PROPERTY_SET', None), 0x100: ('log_util', 'LOGGED_UTILITY_STREAM', None), } ATTR_NAME = createDict(ATTR_INFO, 1) class File(FieldSet): # static_size = 48*8 def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["bytes_allocated"].value * 8 def createFields(self): yield Bytes(self, "signature", 4, "Usually the magic is 'FILE'") yield UInt16(self, "usa_ofs", "Update Sequence Array offset") yield UInt16(self, "usa_count", "Update Sequence Array count") yield UInt64(self, "lsn", "$LogFile sequence number for this record") yield UInt16(self, "sequence_number", "Number of times this mft record has been reused") yield UInt16(self, "link_count", "Number of hard links") yield UInt16(self, "attrs_offset", "Byte offset to the first attribute") yield MFT_Flags(self, "flags") yield UInt32(self, "bytes_in_use", "Number of bytes used in this record") yield UInt32(self, "bytes_allocated", "Number of bytes allocated for this record") yield UInt64(self, "base_mft_record") yield UInt16(self, "next_attr_instance") # The below fields are specific to NTFS 3.1+ (Windows XP and above) yield NullBytes(self, "reserved", 2) yield UInt32(self, "mft_record_number", "Number of this mft record") padding = self.seekByte(self["attrs_offset"].value, relative=True) if padding: yield padding while not self.eof: addr = self.absolute_address + self.current_size if self.stream.readBytes(addr, 4) == "\xFF\xFF\xFF\xFF": yield Bytes(self, "attr_end_marker", 8) break yield Attribute(self, "attr[]") size = self["bytes_in_use"].value - self.current_size//8 if size: yield RawBytes(self, "end_rawdata", size) size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "end_padding", size, "Unused but allocated bytes") def createDescription(self): text = "File" if "filename/filename" in self: text += ' "%s"' % self["filename/filename"].value if "filename/real_size" in self: text += ' (%s)' % self["filename/real_size"].display if "standard_info/file_attr" in self: text += ', %s' % self["standard_info/file_attr"].display return text class NTFS(Parser): MAGIC = "\xEB\x52\x90NTFS " PARSER_TAGS = { "id": "ntfs", "category": "file_system", "description": "NTFS file system", "min_size": 1024*8, "magic": ((MAGIC, 0),), } endian = LITTLE_ENDIAN _cluster_size = None def validate(self): if self.stream.readBytes(0, len(self.MAGIC)) != self.MAGIC: return "Invalid magic string" err = self["mbr/bios"].validate() if err: return err return True def createFields(self): yield MasterBootRecord(self, "mbr") bios = self["mbr/bios"] cluster_size = bios["sectors_per_cluster"].value * bios["bytes_per_sector"].value offset = self["mbr/mft_cluster"].value * cluster_size padding = self.seekByte(offset, relative=False) if padding: yield padding for index in xrange(1000): yield File(self, "file[]") size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "end", size)
11,517
Python
.py
251
37.784861
101
0.622507
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,634
ext2.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/ext2.py
""" EXT2 (Linux) file system parser. Author: Victor Stinner Sources: - EXT2FS source code http://ext2fsd.sourceforge.net/ - Analysis of the Ext2fs structure http://www.nondot.org/sabre/os/files/FileSystems/ext2fs/ """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, Bit, Bits, UInt8, UInt16, UInt32, Enum, String, TimestampUnix32, RawBytes, NullBytes) from hachoir_core.tools import (alignValue, humanDuration, humanFilesize) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler from itertools import izip class DirectoryEntry(FieldSet): file_type = { 1: "Regular", 2: "Directory", 3: "Char. dev.", 4: "Block dev.", 5: "Fifo", 6: "Socket", 7: "Symlink", 8: "Max" } def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["rec_len"].value * 8 def createFields(self): yield UInt32(self, "inode", "Inode") yield UInt16(self, "rec_len", "Record length") yield UInt8(self, "name_len", "Name length") yield Enum(UInt8(self, "file_type", "File type"), self.file_type) yield String(self, "name", self["name_len"].value, "File name") size = (self._size - self.current_size)//8 if size: yield NullBytes(self, "padding", size) def createDescription(self): name = self["name"].value.strip("\0") if name: return "Directory entry: %s" % name else: return "Directory entry (empty)" class Inode(FieldSet): inode_type_name = { 1: "list of bad blocks", 2: "Root directory", 3: "ACL inode", 4: "ACL inode", 5: "Boot loader", 6: "Undelete directory", 8: "EXT3 journal" } file_type = { 1: "Fifo", 2: "Character device", 4: "Directory", 6: "Block device", 8: "Regular", 10: "Symbolic link", 12: "Socket", } file_type_letter = { 1: "p", 4: "d", 2: "c", 6: "b", 10: "l", 12: "s", } static_size = (68 + 15*4)*8 def __init__(self, parent, name, index): FieldSet.__init__(self, parent, name, None) self.uniq_id = 1+index def createDescription(self): desc = "Inode %s: " % self.uniq_id size = self["size"].value if self["blocks"].value == 0: desc += "(unused)" elif 11 <= self.uniq_id: size = humanFilesize(size) desc += "file, size=%s, mode=%s" % (size, self.getMode()) else: if self.uniq_id in self.inode_type_name: desc += self.inode_type_name[self.uniq_id] if self.uniq_id == 2: desc += " (%s)" % self.getMode() else: desc += "special" return desc def getMode(self): names = ( ("owner_read", "owner_write", "owner_exec"), ("group_read", "group_write", "group_exec"), ("other_read", "other_write", "other_exec")) letters = "rwx" mode = [ "-" for index in xrange(10) ] index = 1 for loop in xrange(3): for name, letter in izip(names[loop], letters): if self[name].value: mode[index] = letter index += 1 file_type = self["file_type"].value if file_type in self.file_type_letter: mode[0] = self.file_type_letter[file_type] return "".join(mode) def createFields(self): # File mode yield Bit(self, "other_exec") yield Bit(self, "other_write") yield Bit(self, "other_read") yield Bit(self, "group_exec") yield Bit(self, "group_write") yield Bit(self, "group_read") yield Bit(self, "owner_exec") yield Bit(self, "owner_write") yield Bit(self, "owner_read") yield Bit(self, "sticky") yield Bit(self, "setgid") yield Bit(self, "setuid") yield Enum(Bits(self, "file_type", 4), self.file_type) yield UInt16(self, "uid", "User ID") yield UInt32(self, "size", "File size (in bytes)") yield TimestampUnix32(self, "atime", "Last access time") yield TimestampUnix32(self, "ctime", "Creation time") yield TimestampUnix32(self, "mtime", "Last modification time") yield TimestampUnix32(self, "dtime", "Delete time") yield UInt16(self, "gid", "Group ID") yield UInt16(self, "links_count", "Links count") yield UInt32(self, "blocks", "Number of blocks") yield UInt32(self, "flags", "Flags") yield NullBytes(self, "reserved[]", 4, "Reserved") for index in xrange(15): yield UInt32(self, "block[]") yield UInt32(self, "version", "Version") yield UInt32(self, "file_acl", "File ACL") yield UInt32(self, "dir_acl", "Directory ACL") yield UInt32(self, "faddr", "Block where the fragment of the file resides") os = self["/superblock/creator_os"].value if os == SuperBlock.OS_LINUX: yield UInt8(self, "frag", "Number of fragments in the block") yield UInt8(self, "fsize", "Fragment size") yield UInt16(self, "padding", "Padding") yield UInt16(self, "uid_high", "High 16 bits of user ID") yield UInt16(self, "gid_high", "High 16 bits of group ID") yield NullBytes(self, "reserved[]", 4, "Reserved") elif os == SuperBlock.OS_HURD: yield UInt8(self, "frag", "Number of fragments in the block") yield UInt8(self, "fsize", "Fragment size") yield UInt16(self, "mode_high", "High 16 bits of mode") yield UInt16(self, "uid_high", "High 16 bits of user ID") yield UInt16(self, "gid_high", "High 16 bits of group ID") yield UInt32(self, "author", "Author ID (?)") else: yield RawBytes(self, "raw", 12, "Reserved") class Bitmap(FieldSet): def __init__(self, parent, name, start, size, description, **kw): description = "%s: %s items" % (description, size) FieldSet.__init__(self, parent, name, description, size=size, **kw) self.start = 1+start def createFields(self): for index in xrange(self._size): yield Bit(self, "item[]", "Item %s" % (self.start+index)) BlockBitmap = Bitmap InodeBitmap = Bitmap class GroupDescriptor(FieldSet): static_size = 32*8 def __init__(self, parent, name, index): FieldSet.__init__(self, parent, name) self.uniq_id = index def createDescription(self): blocks_per_group = self["/superblock/blocks_per_group"].value start = self.uniq_id * blocks_per_group end = start + blocks_per_group return "Group descriptor: blocks %s-%s" % (start, end) def createFields(self): yield UInt32(self, "block_bitmap", "Points to the blocks bitmap block") yield UInt32(self, "inode_bitmap", "Points to the inodes bitmap block") yield UInt32(self, "inode_table", "Points to the inodes table first block") yield UInt16(self, "free_blocks_count", "Number of free blocks") yield UInt16(self, "free_inodes_count", "Number of free inodes") yield UInt16(self, "used_dirs_count", "Number of inodes allocated to directories") yield UInt16(self, "padding", "Padding") yield NullBytes(self, "reserved", 12, "Reserved") class SuperBlock(FieldSet): static_size = 433*8 OS_LINUX = 0 OS_HURD = 1 os_name = { 0: "Linux", 1: "Hurd", 2: "Masix", 3: "FreeBSD", 4: "Lites", 5: "WinNT" } state_desc = { 1: "Valid (Unmounted cleanly)", 2: "Error (Errors detected)", 4: "Orphan FS (Orphans being recovered)", } error_handling_desc = { 1: "Continue" } def __init__(self, parent, name): FieldSet.__init__(self, parent, name) self._group_count = None def createDescription(self): if self["feature_compat"].value & 4: fstype = "ext3" else: fstype = "ext2" return "Superblock: %s file system" % fstype def createFields(self): yield UInt32(self, "inodes_count", "Inodes count") yield UInt32(self, "blocks_count", "Blocks count") yield UInt32(self, "r_blocks_count", "Reserved blocks count") yield UInt32(self, "free_blocks_count", "Free blocks count") yield UInt32(self, "free_inodes_count", "Free inodes count") yield UInt32(self, "first_data_block", "First data block") yield UInt32(self, "log_block_size", "Block size") yield UInt32(self, "log_frag_size", "Fragment size") yield UInt32(self, "blocks_per_group", "Blocks per group") yield UInt32(self, "frags_per_group", "Fragments per group") yield UInt32(self, "inodes_per_group", "Inodes per group") yield TimestampUnix32(self, "mtime", "Mount time") yield TimestampUnix32(self, "wtime", "Write time") yield UInt16(self, "mnt_count", "Mount count") yield UInt16(self, "max_mnt_count", "Max mount count") yield String(self, "magic", 2, "Magic number (0x53EF)") yield Enum(UInt16(self, "state", "File system state"), self.state_desc) yield Enum(UInt16(self, "errors", "Behaviour when detecting errors"), self.error_handling_desc) yield UInt16(self, "minor_rev_level", "Minor revision level") yield TimestampUnix32(self, "last_check", "Time of last check") yield textHandler(UInt32(self, "check_interval", "Maximum time between checks"), self.postMaxTime) yield Enum(UInt32(self, "creator_os", "Creator OS"), self.os_name) yield UInt32(self, "rev_level", "Revision level") yield UInt16(self, "def_resuid", "Default uid for reserved blocks") yield UInt16(self, "def_resgid", "Default gid for reserved blocks") yield UInt32(self, "first_ino", "First non-reserved inode") yield UInt16(self, "inode_size", "Size of inode structure") yield UInt16(self, "block_group_nr", "Block group # of this superblock") yield UInt32(self, "feature_compat", "Compatible feature set") yield UInt32(self, "feature_incompat", "Incompatible feature set") yield UInt32(self, "feature_ro_compat", "Read-only compatible feature set") yield RawBytes(self, "uuid", 16, "128-bit uuid for volume") yield String(self, "volume_name", 16, "Volume name", strip="\0") yield String(self, "last_mounted", 64, "Directory where last mounted", strip="\0") yield UInt32(self, "compression", "For compression (algorithm usage bitmap)") yield UInt8(self, "prealloc_blocks", "Number of blocks to try to preallocate") yield UInt8(self, "prealloc_dir_blocks", "Number to preallocate for directories") yield UInt16(self, "padding", "Padding") yield String(self, "journal_uuid", 16, "uuid of journal superblock") yield UInt32(self, "journal_inum", "inode number of journal file") yield UInt32(self, "journal_dev", "device number of journal file") yield UInt32(self, "last_orphan", "start of list of inodes to delete") yield RawBytes(self, "reserved", 197, "Reserved") def _getGroupCount(self): if self._group_count is None: # Calculate number of groups blocks_per_group = self["blocks_per_group"].value self._group_count = (self["blocks_count"].value - self["first_data_block"].value + (blocks_per_group - 1)) / blocks_per_group return self._group_count group_count = property(_getGroupCount) def postMaxTime(self, chunk): return humanDuration(chunk.value * 1000) class GroupDescriptors(FieldSet): def __init__(self, parent, name, count): FieldSet.__init__(self, parent, name) self.count = count def createDescription(self): return "Group descriptors: %s items" % self.count def createFields(self): for index in range(0, self.count): yield GroupDescriptor(self, "group[]", index) class InodeTable(FieldSet): def __init__(self, parent, name, start, count): FieldSet.__init__(self, parent, name) self.start = start self.count = count self._size = self.count * self["/superblock/inode_size"].value * 8 def createDescription(self): return "Group descriptors: %s items" % self.count def createFields(self): for index in range(self.start, self.start+self.count): yield Inode(self, "inode[]", index) class Group(FieldSet): def __init__(self, parent, name, index): FieldSet.__init__(self, parent, name) self.uniq_id = index def createDescription(self): desc = "Group %s: %s" % (self.uniq_id, humanFilesize(self.size/8)) if "superblock_copy" in self: desc += " (with superblock copy)" return desc def createFields(self): group = self["../group_desc/group[%u]" % self.uniq_id] superblock = self["/superblock"] block_size = self["/"].block_size # Read block bitmap addr = self.absolute_address + 56*8 self.superblock_copy = (self.stream.readBytes(addr, 2) == "\x53\xEF") if self.superblock_copy: yield SuperBlock(self, "superblock_copy") # Compute number of block and inodes block_count = superblock["blocks_per_group"].value inode_count = superblock["inodes_per_group"].value block_index = self.uniq_id * block_count inode_index = self.uniq_id * inode_count if (block_count % 8) != 0: raise ParserError("Invalid block count") if (inode_count % 8) != 0: raise ParserError("Invalid inode count") block_count = min(block_count, superblock["blocks_count"].value - block_index) inode_count = min(inode_count, superblock["inodes_count"].value - inode_index) # Read block bitmap field = self.seekByte(group["block_bitmap"].value * block_size, relative=False, null=True) if field: yield field yield BlockBitmap(self, "block_bitmap", block_index, block_count, "Block bitmap") # Read inode bitmap field = self.seekByte(group["inode_bitmap"].value * block_size, relative=False) if field: yield field yield InodeBitmap(self, "inode_bitmap", inode_index, inode_count, "Inode bitmap") # Read inode table field = self.seekByte(alignValue(self.current_size//8, block_size)) if field: yield field yield InodeTable(self, "inode_table", inode_index, inode_count) # Add padding if needed addr = min(self.parent.size / 8, (self.uniq_id+1) * superblock["blocks_per_group"].value * block_size) yield self.seekByte(addr, "data", relative=False) class EXT2_FS(Parser): """ Parse an EXT2 or EXT3 partition. Attributes: * block_size: Size of a block (in bytes) Fields: * superblock: Most important block, store most important informations * ... """ PARSER_TAGS = { "id": "ext2", "category": "file_system", "description": "EXT2/EXT3 file system", "min_size": (1024*2)*8, "magic": ( # (magic, state=valid) ("\x53\xEF\1\0", 1080*8), # (magic, state=error) ("\x53\xEF\2\0", 1080*8), # (magic, state=error) ("\x53\xEF\4\0", 1080*8), ), } endian = LITTLE_ENDIAN def validate(self): if self.stream.readBytes((1024+56)*8, 2) != "\x53\xEF": return "Invalid magic number" if not(0 <= self["superblock/log_block_size"].value <= 2): return "Invalid (log) block size" if self["superblock/inode_size"].value != (68 + 15*4): return "Unsupported inode size" return True def createFields(self): # Skip something (what is stored here? MBR?) yield NullBytes(self, "padding[]", 1024) # Read superblock superblock = SuperBlock(self, "superblock") yield superblock if not(0 <= self["superblock/log_block_size"].value <= 2): raise ParserError("EXT2: Invalid (log) block size") self.block_size = 1024 << superblock["log_block_size"].value # in bytes # Read groups' descriptor field = self.seekByte(((1023 + superblock.size/8) / self.block_size + 1) * self.block_size, null=True) if field: yield field groups = GroupDescriptors(self, "group_desc", superblock.group_count) yield groups # Read groups address = groups["group[0]/block_bitmap"].value * self.block_size field = self.seekByte(address, null=True) if field: yield field for index in range(0, superblock.group_count): yield Group(self, "group[]", index) def getSuperblock(self): # FIXME: Use superblock copy if main superblock is invalid return self["superblock"] def createDescription(self): superblock = self.getSuperblock() block_size = 1024 << superblock["log_block_size"].value nb_block = superblock["blocks_count"].value total = nb_block * block_size used = (superblock["free_blocks_count"].value) * block_size desc = "EXT2/EXT3" if "group[0]/inode_table/inode[7]/blocks" in self: if 0 < self["group[0]/inode_table/inode[7]/blocks"].value: desc = "EXT3" else: desc = "EXT2" return desc + " file system: total=%s, used=%s, block=%s" % ( humanFilesize(total), humanFilesize(used), humanFilesize(block_size))
18,035
Python
.py
409
35.271394
137
0.601275
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,635
mbr.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/mbr.pyc
—Ú Œ »Mc @s dZddklZddklZlZlZlZlZl Z l Z ddk lZddk l Z ddklZddklZlZdZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZdefdÑÉYZdeefdÑÉYZdS(s Master Boot Record. iˇˇˇˇ(tParser(tFieldSettEnumtBitstUInt8tUInt16tUInt32tRawBytes(R(t LITTLE_ENDIAN(t humanFilesize(t textHandlert hexadecimalitCylinderNumbercBseZddÑZdÑZRS(cCsti|||d|ÉdS(Ni (Rt__init__(tselftparenttnamet description((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyR scCs>|iii|it|i|iiÉ}|d?|dd>BS(Niii(Rtstreamt readIntegertabsolute_addresstFalset_sizetendian(Rti((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyt createValues N(t__name__t __module__tNoneR R(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyR s tPartitionHeadercBs¡eZdªZh^dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dRdS6dTdU6dVdW6dXdY6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dldm6dldn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|6d}d~6ddÄ6dÅdÇ6dÉdÑ6dÖdÜ6dádà6dâdä6dãdå6dçdé6dèdê6dëdí6dìdî6dïdñ6dódò6dôdö6dõdú6dùdû6düd†6d°d¢6d£d§6dTd•6d¶dß6d®d©6d™d´6d¨d≠6dTdÆ6dTdØ6d∞d±6d≤d≥6d¥dµ6d∂d∑6Zd∏ÑZdπÑZd∫ÑZRS(ºiitEmptyitFAT12is XENIX rootis XENIX usris FAT16 <32MitExtendeditFAT16is HPFS/NTFSitAIXs AIX bootablei sOS/2 Boot Manageri s W95 FAT32i sW95 FAT32 (LBA)i sW95 FAT16 (LBA)isW95 Ext'd (LBA)itOPUSs Hidden FAT12isCompaq diagnosticsisHidden FAT16 <32Mis Hidden FAT16isHidden HPFS/NTFSisAST SmartSleepisHidden W95 FAT32isHidden W95 FAT32 (LBA)isHidden W95 FAT16 (LBA)isNEC DOSi$sPlan 9i9sPartitionMagic recoveryi<s Venix 80286i@s PPC PReP BootiAtSFSiBsQNX4.xiMsQNX4.x 2nd partiNsQNX4.x 3rd partiOs OnTrack DMiPsOnTrack DM6 Aux1iQsCP/MiRsOnTrack DM6 Aux3iSt OnTrackDM6iTsEZ-DriveiUs Golden BowiVs Priam Ediski\t SpeedStoriasGNU HURD or SysVicsNovell Netware 286idsNovell Netware 386iesDiskSecure Multi-BootipsPC/IXius Old MinixiÄsMinix / old LinuxiÅsLinux swap / SolarisiÇsLinux (ext2/ext3)iÉsOS/2 hidden C: driveiÑsLinux extendediÖsNTFS volume setiÜiásLinux plaintextiàs Linux LVMiétAmoebaiìs Amoeba BBTiîsBSD/OSiüsIBM Thinkpad hibernationi†tFreeBSDi•tOpenBSDi¶tNeXTSTEPißs Darwin UFSi®tNetBSDi©s Darwin booti´sBSDI fsi∑s BSDI swapi∏sBoot Wizard hiddeniªs Solaris bootiætSolarisiøsDRDOS/sec (FAT-12)i¡sDRDOS/sec (FAT-16 < 32M)iƒsDRDOS/sec (FAT-16)i∆tSyrinxi«s Non-FS datai⁄sCP/M / CTOS / ...i€s Dell UtilityifitBootItifls DOS accessi·sDOS R/Oi„i‰sBeOS fsiÎsEFI GPTiÓsEFI (FAT-12/16/32)iÔsLinux/PA-RISC bootiiÒiÙs DOS secondaryiÚsLinux raid autodetecti˝tLANstepi˛tBBTiˇccsÂt|ddÉV|didjo|idÉnt|ddÉVt|dd d ÉVt|d d ÉVtt|d dÉ|iÉVt|ddÉVt|dd dÉVt|ddÉVt|ddÉVt|ddÉVdS(Ntbootables&Bootable flag (true if equals to 0x80)iiÄsGStream doesn't look like master boot record (partition bootable error)!t start_heads%Starting head number of the partitiont start_sectoris'Starting sector number of the partitiontstart_cylinders)Starting cylinder number of the partitiontsystemsSystem indicatortend_heads#Ending head number of the partitiont end_sectors%Ending sector number of the partitiont end_cylinders'Ending cylinder number of the partitiontLBAs-LBA (number of sectors before this partition)tsizesSize (block count)(iiÄ(RtvaluetwarningRR Rt system_nameR(R((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyt createFieldsâscCs|didjS(NR5i(R;(R((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pytisUsedóscCs]d}|iÉo<|di}|dit}|d|t|Éf7}n |d7}|S(NsPartition header: R5R:s%s, %ss(unused)(R?tdisplayR;t BLOCK_SIZER (RtdescR5R:((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pytcreateDescriptionös   iÄ(RRt static_sizeR=R>R?RC(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyR#s∆   tMasterBootRecordcBs,eZdZdÑZdÑZeeÉZRS(iiccsjt|dddÉVt|dÉVt|dÉVt|dÉVt|dÉVtt|dd ÉtÉVdS( Ntprogramiæs%Boot program (Intel x86 machine code)s header[0]s header[1]s header[2]s header[3]t signaturesSignature (0xAA55)(RRR RR (R((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyR>®s csáfdÜtddÉDÉS(Nc3sx|]}à|VqWdS(N((t.0tindex(R(sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pys <genexpr>±s ii(txrange(R((RsH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyt_getPartitions∞si(RRRDR>RKtpropertytheaders(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyRE•s  t PartitioncBseZdÑZRS(c cst|dÉ}|V|iodSx¬tdÑt|iÉDÉÉD]°\}}}|i|tdÉ}|o |Vnd|}t|di}|di}|didjot ||||dÉVqCt ||||ÉVqCW|i |i jo|i |i d ÉVndS( Ntmbrcss@x9|]2\}}|iÉo|di||fVqqWdS(R9N(R?R;(RHRIthdr((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pys <genexpr>æs s padding[]s partition[%u]R:R5iitend(REteoftsortedt enumerateRMtseekByteRAR;R@RNRt current_sizeRtseekBit( RROtstartRItheadertpaddingRR:RB((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyR>∂s$     (RRR>(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyRNµstMSDos_HardDrivecBsFeZeZdZhdd6dd6dd6d d 6dd 6Zd ÑZRS(sU™tmsdos_harddrivetidt file_systemtcategorys/MS-DOS hard drive with Master Boot Record (MBR)Riitmin_sizettfile_extcCsv|iid dÉ|ijodSt}x>|diD]/}|did jod S||iÉO}q8W|pd S( Ni˛iisInvalid signatureROR1iiÄsWrong boot flagsNo partition foundi(iiÄ(Rt readBytestMAGICRRMR;R?(RtusedRP((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pytvalidateflsi(Ra(RRRRRdt PARSER_TAGSRf(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyR[”s N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRthachoir_core.field.integerthachoir_core.endianRthachoir_core.toolsR thachoir_core.text_handlerR R RAR RRERNR[(((sH/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/mbr.pyt<module>s 4 Ç
9,723
Python
.py
35
276.714286
1,015
0.4952
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,636
reiser_fs.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/reiser_fs.py
""" ReiserFS file system version 3 parser (version 1, 2 and 4 are not supported). Author: Frederic Weisbecker Creation date: 8 december 2006 Sources: - http://p-nand-q.com/download/rfstool/reiserfs_docs.html - http://homes.cerias.purdue.edu/~florian/reiser/reiserfs.php - file://usr/src/linux-2.6.16.19/include/linux/reiserfs_fs.h NOTES: The most part of the description of the structures, their fields and their comments decribed here comes from the file include/linux/reiserfs_fs.h - written by Hans reiser - located in the Linux kernel 2.6.16.19 and from the Reiserfs explanations in http://p-nand-q.com/download/rfstool/reiserfs_docs.html written by Gerson Kurz. """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Enum, UInt16, UInt32, String, RawBytes, NullBytes) from hachoir_core.endian import LITTLE_ENDIAN class Journal_params(FieldSet): static_size = 32*8 def createFields(self): yield UInt32(self, "1st_block", "Journal 1st block number") yield UInt32(self, "dev", "Journal device number") yield UInt32(self, "size", "Size of the journal") yield UInt32(self, "trans_max", "Max number of blocks in a transaction") #TODO: Must be explained: it was sb_journal_block_count yield UInt32(self, "magic", "Random value made on fs creation.") yield UInt32(self, "max_batch", "Max number of blocks to batch into a trans") yield UInt32(self, "max_commit_age", "In seconds, how old can an async commit be") yield UInt32(self, "max_trans_age", "In seconds, how old can a transaction be") def createDescription(self): return "Parameters of the journal" class SuperBlock(FieldSet): static_size = 204*8 UMOUNT_STATE = { 1: "unmounted", 2: "not unmounted" } HASH_FUNCTIONS = { 0: "UNSET_HASH", 1: "TEA_HASH", 2: "YURA_HASH", 3: "R5_HASH" } def createFields(self): #TODO: This structure is normally divided in two parts: # _reiserfs_super_block_v1 # _reiserfs_super_block # It will be divided later to easily support older version of the first part yield UInt32(self, "block_count", "Number of blocks") yield UInt32(self, "free_blocks", "Number of free blocks") yield UInt32(self, "root_block", "Root block number") yield Journal_params(self, "Journal parameters") yield UInt16(self, "blocksize", "Size of a block") yield UInt16(self, "oid_maxsize", "Max size of object id array") yield UInt16(self, "oid_cursize", "Current size of object id array") yield Enum(UInt16(self, "umount_state", "Filesystem umounted or not"), self.UMOUNT_STATE) yield String(self, "magic", 10, "Magic string", strip="\0") #TODO: change the type of s_fs_state in Enum to have more details about this fsck state yield UInt16(self, "fs_state", "Rebuilding phase of fsck ") yield Enum(UInt32(self, "hash_function", "Hash function to sort names in a directory"), self.HASH_FUNCTIONS) yield UInt16(self, "tree_height", "Height of disk tree") yield UInt16(self, "bmap_nr", "Amount of bitmap blocks needed to address each block of file system") #TODO: find a good description for this field yield UInt16(self, "version", "Field only reliable on filesystem with non-standard journal") yield UInt16(self, "reserved_for_journal", "Size in blocks of journal area on main device") #TODO: same as above yield UInt32(self, "inode_generation", "No description") #TODO: same as above and should be an enum field yield UInt32(self, "flags", "No description") #TODO: Create a special Type to format this id yield RawBytes(self, "uuid", 16, "Filesystem unique identifier") yield String(self, "label", 16, "Filesystem volume label", strip="\0") yield NullBytes(self, "unused", 88) def createDescription(self): return "Superblock: ReiserFs Filesystem" class REISER_FS(Parser): PARSER_TAGS = { "id": "reiserfs", "category": "file_system", # 130 blocks before the journal + # Minimal size of journal (513 blocks) + # 1 block for the rest # And The Minimal size of a block is 512 bytes "min_size": (130+513+1) * (512*8), "description": "ReiserFS file system" } endian = LITTLE_ENDIAN # Offsets (in bytes) of important information SUPERBLOCK_OFFSET = 64*1024 MAGIC_OFFSET = SUPERBLOCK_OFFSET + 52 def validate(self): # Let's look at the magic field in the superblock magic = self.stream.readBytes(self.MAGIC_OFFSET*8, 9).rstrip("\0") if magic == "ReIsEr3Fs": return True if magic in ("ReIsEr2Fs", "ReIsErFs"): return "Unsupported version of ReiserFs" return "Invalid magic string" def createFields(self): yield NullBytes(self, "padding[]", self.SUPERBLOCK_OFFSET) yield SuperBlock(self, "superblock")
5,065
Python
.py
101
43.306931
116
0.675834
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,637
__init__.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/__init__.py
from hachoir_parser.file_system.ext2 import EXT2_FS from hachoir_parser.file_system.fat import FAT12, FAT16, FAT32 from hachoir_parser.file_system.mbr import MSDos_HardDrive from hachoir_parser.file_system.ntfs import NTFS from hachoir_parser.file_system.iso9660 import ISO9660 from hachoir_parser.file_system.reiser_fs import REISER_FS from hachoir_parser.file_system.linux_swap import LinuxSwapFile
402
Python
.py
7
56.285714
63
0.852792
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,638
fat.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/fat.py
from hachoir_core.compatibility import sorted from hachoir_parser import Parser from hachoir_core.field import (FieldSet, StaticFieldSet, RawBytes, PaddingBytes, createPaddingField, Link, Fragment, Bit, Bits, UInt8, UInt16, UInt32, String, Bytes, NullBytes) from hachoir_core.field.integer import GenericInteger from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.error import error from hachoir_core.tools import humanFilesize, makePrintable import datetime import re strip_index = re.compile(r'\[[^]]+]$') class Boot(FieldSet): static_size = 512*8 def createFields(self): yield Bytes(self, "jmp", 3, "Jump instruction (to skip over header on boot)") yield Bytes(self, "oem_name", 8, "OEM Name (padded with spaces)") yield UInt16(self, "sector_size", "Bytes per sector") yield UInt8 (self, "cluster_size", "Sectors per cluster") yield UInt16(self, "reserved_sectors", "Reserved sector count (including boot sector)") yield UInt8 (self, "fat_nb", "Number of file allocation tables") yield UInt16(self, "max_root", "Maximum number of root directory entries") yield UInt16(self, "sectors1", "Total sectors (if zero, use 'sectors2')") yield UInt8 (self, "media_desc", "Media descriptor") yield UInt16(self, "fat_size", "Sectors per FAT") yield UInt16(self, "track_size", "Sectors per track") yield UInt16(self, "head_nb", "Number of heads") yield UInt32(self, "hidden", "Hidden sectors") yield UInt32(self, "sectors2", "Total sectors (if greater than 65535)") if self.parent.version == 32: yield UInt32(self, "fat32_size", "Sectors per FAT") yield UInt16(self, "fat_flags", "FAT Flags") yield UInt16(self, "version", "Version") yield UInt32(self, "root_start", "Cluster number of root directory start") yield UInt16(self, "inf_sector", "Sector number of FS Information Sector") yield UInt16(self, "boot_copy", "Sector number of a copy of this boot sector") yield NullBytes(self, "reserved[]", 12, "Reserved") yield UInt8(self, "phys_drv", "Physical drive number") yield NullBytes(self, "reserved[]", 1, 'Reserved ("current head")') yield UInt8(self, "sign", "Signature") yield textHandler(UInt32(self, "serial", "ID (serial number)"), hexadecimal) yield String(self, "label", 11, "Volume Label", strip=' ', charset="ASCII") yield String(self, "fs_type", 8, "FAT file system type", strip=' ', charset="ASCII") yield Bytes(self, "code", 510-self.current_size/8, "Operating system boot code") yield Bytes(self, "trail_sig", 2, "Signature (0x55 0xAA)") class FSInfo(StaticFieldSet): format = ( (String, "lead_sig", 4, 'Signature ("RRaA")'), (NullBytes, "reserved[]", 480), (String, "struct_sig", 4, 'Signature ("rrAa")'), (UInt32, "free_count", "Last known free cluster count on the volume"), (UInt32, "nxt_free",), (NullBytes, "reserved[]", 12), (Bytes, "trail_sig", 4, "Signature (0x00 0x00 0x55 0xAA)") ) class FAT(FieldSet): class FAT(FieldSet): def createFields(self): parent = self.parent version = parent.parent.version text_handler = parent.text_handler while self.current_size < self._size: yield textHandler(GenericInteger(self, 'entry[]', False, version), text_handler) def createFields(self): version = self.parent.version max_entry = 1 << min(28, version) def FatEntry(chunk): i = chunk.value j = (1 - i) % max_entry if j == 0: return "reserved cluster" elif j == 1: return "free cluster" elif j < 10: return "end of a chain" elif j == 10: return "bad cluster" elif j < 18: return "reserved value" else: return str(i) self.text_handler = FatEntry while self.current_size < self._size: yield FAT.FAT(self, 'group[]', size=min(1000*version,self._size-self.current_size)) class Date(FieldSet): def __init__(self, parent, name): FieldSet.__init__(self, parent, name, size={ "create": 5, "access": 2, "modify": 4, }[name] * 8) def createFields(self): size = self.size / 8 if size > 2: if size > 4: yield UInt8(self, "cs", "10ms units, values from 0 to 199") yield Bits(self, "2sec", 5, "seconds/2") yield Bits(self, "min", 6, "minutes") yield Bits(self, "hour", 5, "hours") yield Bits(self, "day", 5, "(1-31)") yield Bits(self, "month", 4, "(1-12)") yield Bits(self, "year", 7, "(0 = 1980, 127 = 2107)") def createDescription(self): date = [ self["year"].value, self["month"].value, self["day"].value ] size = self.size / 8 if size > 2: mkdate = datetime.datetime cs = 200 * self["2sec"].value if size > 4: cs += self["cs"].value date += [ self["hour"].value, self["min"].value, cs / 100, cs % 100 * 10000 ] else: mkdate = datetime.date if date == [ 0 for i in date ]: date = None else: date[0] += 1980 try: date = mkdate(*tuple(date)) except ValueError: return "invalid" return str(date) class InodeLink(Link): def __init__(self, parent, name, target=None): Link.__init__(self, parent, name) self.target = target self.first = None def _getTargetPath(self): if not self.target: parent = self.parent self.target = strip_index.sub(r"\\", parent.parent._name) + parent.getFilename().rstrip("/") return self.target def createValue(self): field = InodeGen(self["/"], self.parent, self._getTargetPath())(self) if field: self._display = field.path return Link.createValue(self) def createDisplay(self): return "/%s[0]" % self._getTargetPath() class FileEntry(FieldSet): static_size = 32*8 process = False LFN = False def __init__(self, *args): FieldSet.__init__(self, *args) self.status = self.stream.readBits(self.absolute_address, 8, LITTLE_ENDIAN) if self.status in (0, 0xE5): return magic = self.stream.readBits(self.absolute_address+11*8, 8, LITTLE_ENDIAN) if magic & 0x3F == 0x0F: self.LFN = True elif self.getFilename() not in (".", ".."): self.process = True def getFilename(self): name = self["name"].value if isinstance(name, str): name = makePrintable(name, "ASCII", to_unicode=True) ext = self["ext"].value if ext: name += "." + ext if name[0] == 5: name = "\xE5" + name[1:] if not self.LFN and self["directory"].value: name += "/" return name def createDescription(self): if self.status == 0: return "Free entry" elif self.status == 0xE5: return "Deleted file" elif self.LFN: name = "".join( field.value for field in self.array("name") ) try: name = name[:name.index('\0')] except ValueError: pass seq_no = self["seq_no"].value return "Long filename part: '%s' [%u]" % (name, seq_no) else: return "File: '%s'" % self.getFilename() def getCluster(self): cluster = self["cluster_lo"].value if self.parent.parent.version > 16: cluster += self["cluster_hi"].value << 16 return cluster def createFields(self): if not self.LFN: yield String(self, "name", 8, "DOS file name (padded with spaces)", strip=' ', charset="ASCII") yield String(self, "ext", 3, "DOS file extension (padded with spaces)", strip=' ', charset="ASCII") yield Bit(self, "read_only") yield Bit(self, "hidden") yield Bit(self, "system") yield Bit(self, "volume_label") yield Bit(self, "directory") yield Bit(self, "archive") yield Bit(self, "device") yield Bit(self, "unused") yield RawBytes(self, "reserved", 1, "Something about the case") yield Date(self, "create") yield Date(self, "access") if self.parent.parent.version > 16: yield UInt16(self, "cluster_hi") else: yield UInt16(self, "ea_index") yield Date(self, "modify") yield UInt16(self, "cluster_lo") size = UInt32(self, "size") yield size if self.process: del self.process target_size = size.value if self["directory"].value: if target_size: size.error("(FAT) value must be zero") target_size = 0 elif not target_size: return self.target_size = 8 * target_size yield InodeLink(self, "data") else: yield UInt8(self, "seq_no", "Sequence Number") yield String(self, "name[]", 10, "(5 UTF-16 characters)", charset="UTF-16-LE") yield UInt8(self, "magic", "Magic number (15)") yield NullBytes(self, "reserved", 1, "(always 0)") yield UInt8(self, "checksum", "Checksum of DOS file name") yield String(self, "name[]", 12, "(6 UTF-16 characters)", charset="UTF-16-LE") yield UInt16(self, "first_cluster", "(always 0)") yield String(self, "name[]", 4, "(2 UTF-16 characters)", charset="UTF-16-LE") class Directory(Fragment): def createFields(self): while self.current_size < self._size: yield FileEntry(self, "entry[]") class File(Fragment): def _getData(self): return self["data"] def createFields(self): yield Bytes(self, "data", self.datasize/8) padding = self._size - self.current_size if padding: yield createPaddingField(self, padding) class InodeGen: def __init__(self, root, entry, path): self.root = root self.cluster = root.clusters(entry.getCluster) self.path = path self.filesize = entry.target_size self.done = 0 def createInputStream(cis, **args): args["size"] = self.filesize args.setdefault("tags",[]).append(("filename", entry.getFilename())) return cis(**args) self.createInputStream = createInputStream def __call__(self, prev): name = self.path + "[]" address, size, last = self.cluster.next() if self.filesize: if self.done >= self.filesize: error("(FAT) bad metadata for " + self.path) return field = File(self.root, name, size=size) if prev.first is None: field._description = 'File size: %s' % humanFilesize(self.filesize//8) field.setSubIStream(self.createInputStream) field.datasize = min(self.filesize - self.done, size) self.done += field.datasize else: field = Directory(self.root, name, size=size) padding = self.root.getFieldByAddress(address, feed=False) if not isinstance(padding, (PaddingBytes, RawBytes)): error("(FAT) address %u doesn't point to a padding field" % address) return if last: next = None else: next = lambda: self(field) field.setLinks(prev.first, next) self.root.writeFieldsIn(padding, address, (field,)) return field class FAT_FS(Parser): endian = LITTLE_ENDIAN PARSER_TAGS = { "category": "file_system", "min_size": 512*8, "file_ext": ("",), } def _validate(self, type_offset): if self.stream.readBytes(type_offset*8, 8) != ("FAT%-5u" % self.version): return "Invalid FAT%u signature" % self.version if self.stream.readBytes(510*8, 2) != "\x55\xAA": return "Invalid BIOS signature" return True def clusters(self, cluster_func): max_entry = (1 << min(28, self.version)) - 16 cluster = cluster_func() if 1 < cluster < max_entry: clus_nb = 1 next = cluster while True: next = self.fat[next/1000][next%1000].value if not 1 < next < max_entry: break if cluster + clus_nb == next: clus_nb += 1 else: yield self.data_start + cluster * self.cluster_size, clus_nb * self.cluster_size, False cluster = next clus_nb = 1 yield self.data_start + cluster * self.cluster_size, clus_nb * self.cluster_size, True def createFields(self): # Read boot seector boot = Boot(self, "boot", "Boot sector") yield boot self.sector_size = boot["sector_size"].value if self.version == 32: for field in sorted(( (boot["inf_sector"].value, lambda: FSInfo(self, "fsinfo")), (boot["boot_copy"].value, lambda: Boot(self, "bkboot", "Copy of the boot sector")), )): if field[0]: padding = self.seekByte(field[0] * self.sector_size) if padding: yield padding yield field[1]() padding = self.seekByte(boot["reserved_sectors"].value * self.sector_size) if padding: yield padding # Read the two FAT fat_size = boot["fat_size"].value if fat_size == 0: fat_size = boot["fat32_size"].value fat_size *= self.sector_size * 8 for i in xrange(boot["fat_nb"].value): yield FAT(self, "fat[]", "File Allocation Table", size=fat_size) # Read inode table (Directory) self.cluster_size = boot["cluster_size"].value * self.sector_size * 8 self.fat = self["fat[0]"] if "root_start" in boot: self.target_size = 0 self.getCluster = lambda: boot["root_start"].value yield InodeLink(self, "root", "root") else: yield Directory(self, "root[]", size=boot["max_root"].value * 32 * 8) self.data_start = self.current_size - 2 * self.cluster_size sectors = boot["sectors1"].value if not sectors: sectors = boot["sectors2"].value # Create one big padding field for the end size = sectors * self.sector_size if self._size: size = min(size, self.size//8) padding = self.seekByte(size) if padding: yield padding class FAT12(FAT_FS): PARSER_TAGS = { "id": "fat12", "description": "FAT12 filesystem", "magic": (("FAT12 ", 54*8),), } version = 12 def validate(self): return FAT_FS._validate(self, 54) class FAT16(FAT_FS): PARSER_TAGS = { "id": "fat16", "description": "FAT16 filesystem", "magic": (("FAT16 ", 54*8),), } version = 16 def validate(self): return FAT_FS._validate(self, 54) class FAT32(FAT_FS): PARSER_TAGS = { "id": "fat32", "description": "FAT32 filesystem", "magic": (("FAT32 ", 82*8),), } version = 32 def validate(self): return FAT_FS._validate(self, 82)
16,153
Python
.py
387
31.193798
107
0.55757
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,639
ext2.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/ext2.pyc
—Ú Œ »Mc @sädZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZddklZlZlZddklZddklZddklZdefd ÑÉYZd efd ÑÉYZd efd ÑÉYZeZeZdefdÑÉYZdefdÑÉYZ defdÑÉYZ!defdÑÉYZ"defdÑÉYZ#defdÑÉYZ$dS(sŸ EXT2 (Linux) file system parser. Author: Victor Stinner Sources: - EXT2FS source code http://ext2fsd.sourceforge.net/ - Analysis of the Ext2fs structure http://www.nondot.org/sabre/os/files/FileSystems/ext2fs/ iˇˇˇˇ(tParser( tFieldSett ParserErrortBittBitstUInt8tUInt16tUInt32tEnumtStringtTimestampUnix32tRawBytest NullBytes(t alignValuet humanDurationt humanFilesize(t LITTLE_ENDIAN(t textHandler(tiziptDirectoryEntrycBsaeZhdd6dd6dd6dd6dd 6d d 6d d 6dd6ZdÑZdÑZdÑZRS(tRegularit Directoryis Char. dev.is Block dev.itFifoitSocketitSymlinkitMaxicGs(ti||å|did|_dS(Ntrec_leni(Rt__init__tvaluet_size(tselftargs((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR#sccsüt|ddÉVt|ddÉVt|ddÉVtt|ddÉ|iÉVt|d |did ÉV|i|id }|ot |d |ÉVndS( NtinodetInodeRs Record lengthtname_lens Name lengtht file_types File typetnames File nameitpadding( RRRRR#R RRt current_sizeR (Rtsize((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyt createFields'scCs.|diidÉ}|o d|SdSdS(NR$tsDirectory entry: %ssDirectory entry (empty)(Rtstrip(RR$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pytcreateDescription1s (t__name__t __module__R#RR(R+(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRs   R!cBsÿeZhdd6dd6dd6dd6dd6d d 6d d 6Zhd d6dd6dd6dd 6dd 6dd6dd6Zhdd6dd6dd6dd 6dd6dd6Zdd"d ZdÑZdÑZd ÑZd!ÑZ RS(#slist of bad blocksisRoot directoryis ACL inodeiis Boot loaderisUndelete directoryis EXT3 journaliRsCharacter deviceRs Block deviceRs Symbolic linki Ri tptdtctbtltsiDicCs'ti|||dÉd||_dS(Ni(RRtNonetuniq_id(RtparentR$tindex((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRUscCs◊d|i}|di}|didjo|d7}nòd|ijo*t|É}|d||iÉf7}n^|i|ijo@||i|i7}|idjo|d |iÉ7}q”n |d 7}|S( Ns Inode %s: R'tblocksis(unused)i sfile, size=%s, mode=%sis (%s)tspecial(R5RRtgetModetinode_type_name(RtdescR'((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+Ys    c Cs‚dddf}d }g}td ÉD] }|d q&~}d }x^tdÉD]P}xGt|||ÉD]2\}}||io|||<n|d 7}qiWqOW|di} | |ijo|i| |d<ndi|ÉS(Nt owner_readt owner_writet owner_exect group_readt group_writet group_exect other_readt other_writet other_exectrwxi t-iiR#it(R=R>R?(R@RARB(RCRDRE(txrangeRRtfile_type_lettertjoin( Rtnamestletterst_[1]R7tmodetloopR$tletterR#((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR:js" '   ccst|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|d ÉVt|d ÉVt|d ÉVt|d ÉVtt|d dÉ|iÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|dd ÉVt|d!d"ÉVt|d#dd$ÉVx"td%ÉD]}t|d&ÉVqêWt|d'd(ÉVt|d)d*ÉVt|d+d,ÉVt|d-d.ÉV|d/i }|t i jomt |d0d1ÉVt |d2d3ÉVt|d4d5ÉVt|d6d7ÉVt|d8d9ÉVt|d#dd$ÉVnè|t i jojt |d0d1ÉVt |d2d3ÉVt|d:d;ÉVt|d6d7ÉVt|d8d9ÉVt|d<d=ÉVnt|d>d?d$ÉVdS(@NRERDRCRBRAR@R?R>R=tstickytsetgidtsetuidR#ituidsUser IDR'sFile size (in bytes)tatimesLast access timetctimes Creation timetmtimesLast modification timetdtimes Delete timetgidsGroup IDt links_counts Links countR8sNumber of blockstflagstFlagss reserved[]tReservedisblock[]tversiontVersiontfile_aclsFile ACLtdir_acls Directory ACLtfaddrs,Block where the fragment of the file residess/superblock/creator_ostfrags Number of fragments in the blocktfsizes Fragment sizeR%tPaddingtuid_highsHigh 16 bits of user IDtgid_highsHigh 16 bits of group IDt mode_highsHigh 16 bits of modetauthors Author ID (?)trawi (RRRR#RRR R RIRt SuperBlocktOS_LINUXRtOS_HURDR (RR7tos((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(|s^  i<( R,R-R;R#RJt static_sizeRR+R:R((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR!8s8      tBitmapcBseZdÑZdÑZRS(cKs@d||f}ti||||d||çd||_dS(Ns %s: %s itemsR'i(RRtstart(RR6R$RrR't descriptiontkw((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR±sccs:x3t|iÉD]"}t|dd|i|ÉVqWdS(Nsitem[]sItem %s(RIRRRr(RR7((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(∂s(R,R-RR((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRq∞s tGroupDescriptorcBs)eZdZdÑZdÑZdÑZRS(i icCs ti|||É||_dS(N(RRR5(RR6R$R7((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR¿scCs2|di}|i|}||}d||fS(Ns/superblock/blocks_per_groupsGroup descriptor: blocks %s-%s(RR5(Rtblocks_per_groupRrtend((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+ƒs   ccsèt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d ÉVt|d d ÉVt|d dÉVt|dddÉVdS(Nt block_bitmaps!Points to the blocks bitmap blockt inode_bitmaps!Points to the inodes bitmap blockt inode_tables&Points to the inodes table first blocktfree_blocks_countsNumber of free blockstfree_inodes_countsNumber of free inodestused_dirs_counts)Number of inodes allocated to directoriesR%Rftreservedi R^(RRR (R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR( si(R,R-RpRR+R((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRuΩs  RlcBs´eZdZdZdZhdd6dd6dd6dd 6d d 6d d 6Zhdd6dd6dd 6Zhdd6ZdÑZdÑZ dÑZ dÑZ e e ÉZ dÑZRS(i±iiitLinuxtHurdtMasixitFreeBSDitLitesitWinNTisValid (Unmounted cleanly)sError (Errors detected)s#Orphan FS (Orphans being recovered)tContinuecCs ti|||Éd|_dS(N(RRR4t _group_count(RR6R$((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRËscCs*|did@o d}nd}d|S(Ntfeature_compatitext3text2sSuperblock: %s file system(R(Rtfstype((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+Ïs ccs-t|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d ÉVt|d d ÉVt|d dÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|dd d!ÉVtt|d"d#É|iÉVtt|d$d%É|iÉVt|d&d'ÉVt|d(d)ÉVtt|d*d+É|iÉVtt|d,d-É|i ÉVt|d.d/ÉVt|d0d1ÉVt|d2d3ÉVt|d4d5ÉVt|d6d7ÉVt|d8d9ÉVt|d:d;ÉVt|d<d=ÉVt|d>d?ÉVt |d@dAdBÉVt|dCdAdDdEdFÉVt|dGdHdIdEdFÉVt|dJdKÉVt |dLdMÉVt |dNdOÉVt|dPdQÉVt|dRdAdSÉVt|dTdUÉVt|dVdWÉVt|dXdYÉVt |dZd[d\ÉVdS(]Nt inodes_counts Inodes countt blocks_counts Blocks counttr_blocks_countsReserved blocks countR{sFree blocks countR|sFree inodes counttfirst_data_blocksFirst data blocktlog_block_sizes Block sizet log_frag_sizes Fragment sizeRvsBlocks per grouptfrags_per_groupsFragments per grouptinodes_per_groupsInodes per groupRXs Mount timetwtimes Write timet mnt_counts Mount countt max_mnt_countsMax mount counttmagicisMagic number (0x53EF)tstatesFile system stateterrorssBehaviour when detecting errorstminor_rev_levelsMinor revision levelt last_checksTime of last checktcheck_intervalsMaximum time between checkst creator_oss Creator OSt rev_levelsRevision levelt def_resuidsDefault uid for reserved blockst def_resgidsDefault gid for reserved blockst first_inosFirst non-reserved inodet inode_sizesSize of inode structuretblock_group_nrs Block group # of this superblockRásCompatible feature settfeature_incompatsIncompatible feature settfeature_ro_compats Read-only compatible feature settuuidis128-bit uuid for volumet volume_names Volume nameR*R)t last_mountedi@sDirectory where last mountedt compressions(For compression (algorithm usage bitmap)tprealloc_blockss&Number of blocks to try to preallocatetprealloc_dir_blockss%Number to preallocate for directoriesR%Rft journal_uuidsuuid of journal superblockt journal_inumsinode number of journal filet journal_devsdevice number of journal filet last_orphans!start of list of inodes to deleteR~i≈R^( RR RR Rt state_descterror_handling_descRt postMaxTimetos_nameR R(R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(ÛsVcCsO|idjo8|di}|di|di|d||_n|iS(NRvRåRéi(RÜR4R(RRv((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyt_getGroupCount s +cCst|idÉS(NiË(RR(Rtchunk((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR±(sià (R,R-RpRmRnR≤RØR∞RR+R(R≥tpropertyt group_countR±(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRl‘s*      -  tGroupDescriptorscBs#eZdÑZdÑZdÑZRS(cCs ti|||É||_dS(N(RRtcount(RR6R$R∏((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR,scCs d|iS(NsGroup descriptors: %s items(R∏(R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+0sccs2x+td|iÉD]}t|d|ÉVqWdS(Nisgroup[](trangeR∏Ru(RR7((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(3s(R,R-RR+R((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR∑+s  t InodeTablecBs#eZdÑZdÑZdÑZRS(cCsDti|||É||_||_|i|did|_dS(Ns/superblock/inode_sizei(RRRrR∏RR(RR6R$RrR∏((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR8s  cCs d|iS(NsGroup descriptors: %s items(R∏(R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+>sccs<x5t|i|i|iÉD]}t|d|ÉVqWdS(Nsinode[](RπRrR∏R!(RR7((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(As(R,R-RR+R((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR∫7s  tGroupcBs#eZdÑZdÑZdÑZRS(cCs ti|||É||_dS(N(RRR5(RR6R$R7((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRFscCs?d|it|idÉf}d|jo|d7}n|S(Ns Group %s: %sitsuperblock_copys (with superblock copy)(R5RR'(RR<((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+Js  c cs:|d|i}|d}|di}|id}|ii|dÉdj|_|iot|dÉVn|d i}|d i}|i|}|i|}|dd jotd ÉÇn|dd jotd ÉÇnt ||di|É}t ||di|É}|i |di|dt dt É} | o | Vnt |d||dÉV|i |di|dt É} | o | Vnt|d||dÉV|i t|id|ÉÉ} | o | Vnt|d||ÉVt |iid|id|d i|É}|i |ddt ÉVdS(Ns../group_desc/group[%u]s /superblockt/i8iisSÔRºRvRíisInvalid block countsInvalid inode countRåRãRxtrelativetnulls Block bitmapRys Inode bitmapRzitdatai¿(R5t block_sizetabsolute_addresststreamt readBytesRºRlRRtmintseekBytetFalsetTruet BlockBitmapt InodeBitmapR R&R∫R6R'( Rtgroupt superblockR¡taddrt block_countt inode_countt block_indext inode_indextfield((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(Ps@        &    (R,R-RR+R((((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyRªEs  tEXT2_FScBs|eZdZhdd6dd6dd6dd 6d dfd dfddffd6ZeZdÑZdÑZdÑZdÑZ RS(s“ Parse an EXT2 or EXT3 partition. Attributes: * block_size: Size of a block (in bytes) Fields: * superblock: Most important block, store most important informations * ... Râtidt file_systemtcategorysEXT2/EXT3 file systemRsiiitmin_sizesSÔi8sSÔsSÔRñcCsl|iiddÉdjodSd|dijo djnpd S|d id djodStS(Nii8iisSÔsInvalid magic numberissuperblock/log_block_sizesInvalid (log) block sizessuperblock/inode_sizeiDiisUnsupported inode sizei8i¿!i<(R√RƒRR»(R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pytvalidateôs%ccs5t|ddÉVt|dÉ}|Vd|dijo djnptdÉÇnd|di>|_|id |id |id |id tÉ}|o |Vnt|d |i É}|V|di|i}|i|d tÉ}|o |Vnx+t d|i ÉD]}t |d|ÉVqWdS(Ns padding[]iRÃissuperblock/log_block_sizeisEXT2: Invalid (log) block sizeRèiˇiiRøt group_descsgroup[0]/block_bitmapsgroup[]( R RlRRR¡R∆R'R»R∑R∂RπRª(RRÃR“tgroupstaddressR7((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR(¢s$%2  cCs|dS(NRÃ((R((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyt getSuperblockºscCsß|iÉ}d|di>}|di}||}|di|}d}d|jo(d|dijo d}qÄd }n|d t|Ét|Ét|ÉfS( NiRèRåR{s EXT2/EXT3s$group[0]/inode_table/inode[7]/blocksitEXT3tEXT2s) file system: total=%s, used=%s, block=%s(R‹RR(RRÃR¡tnb_blockttotaltusedR<((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR+¿s      ii@i¿!i¿!i¿!( R,R-t__doc__t PARSER_TAGSRtendianRÿR(R‹R+(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyR”~s     N(%R‚thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R thachoir_core.toolsR RRthachoir_core.endianRthachoir_core.text_handlerRt itertoolsRRR!RqR…R RuRlR∑R∫RªR”(((sI/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/ext2.pyt<module> s"R!x W 9
20,642
Python
.py
106
193.301887
1,558
0.461939
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,640
reiser_fs.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/reiser_fs.pyc
Ñò Î ÈMc@s dZddklZddklZlZlZlZlZl Z l Z ddk l Z defd„ƒYZ defd„ƒYZd efd „ƒYZd S( sŸ ReiserFS file system version 3 parser (version 1, 2 and 4 are not supported). Author: Frederic Weisbecker Creation date: 8 december 2006 Sources: - http://p-nand-q.com/download/rfstool/reiserfs_docs.html - http://homes.cerias.purdue.edu/~florian/reiser/reiserfs.php - file://usr/src/linux-2.6.16.19/include/linux/reiserfs_fs.h NOTES: The most part of the description of the structures, their fields and their comments decribed here comes from the file include/linux/reiserfs_fs.h - written by Hans reiser - located in the Linux kernel 2.6.16.19 and from the Reiserfs explanations in http://p-nand-q.com/download/rfstool/reiserfs_docs.html written by Gerson Kurz. iÿÿÿÿ(tParser(tFieldSettEnumtUInt16tUInt32tStringtRawBytest NullBytes(t LITTLE_ENDIANtJournal_paramscBs eZdZd„Zd„ZRS(i iccsŒt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d ƒVt|d d ƒVt|d dƒVt|ddƒVdS(Nt 1st_blocksJournal 1st block numbertdevsJournal device numbertsizesSize of the journalt trans_maxs%Max number of blocks in a transactiontmagics!Random value made on fs creation.t max_batchs*Max number of blocks to batch into a transtmax_commit_ages*In seconds, how old can an async commit bet max_trans_ages(In seconds, how old can a transaction be(R(tself((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyt createFieldsscCsdS(NsParameters of the journal((R((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pytcreateDescription+si(t__name__t __module__t static_sizeRR(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyR s t SuperBlockcBsVeZdZhdd6dd6Zhdd6dd6d d6d d 6Zd „Zd „ZRS(iÌit unmountedis not unmountedit UNSET_HASHitTEA_HASHt YURA_HASHtR5_HASHiccs‚t|ddƒVt|ddƒVt|ddƒVt|dƒVt|dd ƒVt|d d ƒVt|d d ƒVtt|ddƒ|iƒVt|dddddƒVt|ddƒVtt|ddƒ|iƒVt|ddƒVt|ddƒVt|ddƒVt|dd ƒVt|d!d"ƒVt|d#d"ƒVt|d$d%d&ƒVt|d'd%d(ddƒVt|d)d*ƒVdS(+Nt block_countsNumber of blockst free_blockssNumber of free blockst root_blocksRoot block numbersJournal parameterst blocksizesSize of a blockt oid_maxsizesMax size of object id arrayt oid_cursizesCurrent size of object id arrayt umount_statesFilesystem umounted or notRi s Magic stringtstripttfs_statesRebuilding phase of fsck t hash_functions*Hash function to sort names in a directoryt tree_heightsHeight of disk treetbmap_nrsCAmount of bitmap blocks needed to address each block of file systemtversions;Field only reliable on filesystem with non-standard journaltreserved_for_journals-Size in blocks of journal area on main devicetinode_generationsNo descriptiontflagstuuidisFilesystem unique identifiertlabelsFilesystem volume labeltunusediX( RR RRt UMOUNT_STATERtHASH_FUNCTIONSRR(R((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyR9s(cCsdS(NsSuperblock: ReiserFs Filesystem((R((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyRXsi`(RRRR2R3RR(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyR.s  t REISER_FScBsVeZhdd6dd6ddd 6d d 6ZeZdZedZd„Zd„ZRS(treiserfstidt file_systemtcategoryi‚iiiitmin_sizesReiserFS file systemt descriptioni@ii4cCsM|ii|iddƒidƒ}|djotS|d jodSdS( Nii R&t ReIsEr3Fst ReIsEr2FstReIsErFssUnsupported version of ReiserFssInvalid magic string(R<R=(tstreamt readBytest MAGIC_OFFSETtrstriptTrue(RR((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pytvalidatels %  ccs&t|d|iƒVt|dƒVdS(Ns padding[]t superblock(RtSUPERBLOCK_OFFSETR(R((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyRusiƒi„ii( RRt PARSER_TAGSRtendianRER@RCR(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyR4[s    N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRthachoir_core.endianRR RR4(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/file_system/reiser_fs.pyt<module>s 4-
5,826
Python
.py
34
170.147059
1,166
0.557609
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,641
mbr.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/file_system/mbr.py
""" Master Boot Record. """ # cfdisk uses the following algorithm to compute the geometry: # 0. Use the values given by the user. # 1. Try to guess the geometry from the partition table: # if all the used partitions end at the same head H and the # same sector S, then there are (H+1) heads and S sectors/cylinder. # 2. Ask the system (ioctl/HDIO_GETGEO). # 3. 255 heads and 63 sectors/cylinder. from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Enum, Bits, UInt8, UInt16, UInt32, RawBytes) from hachoir_core.field.integer import Bits from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.tools import humanFilesize from hachoir_core.text_handler import textHandler, hexadecimal BLOCK_SIZE = 512 # bytes class CylinderNumber(Bits): def __init__(self, parent, name, description=None): Bits.__init__(self, parent, name, 10, description) def createValue(self): i = self.parent.stream.readInteger( self.absolute_address, False, self._size, self.parent.endian) return i >> 2 | i % 4 << 8 class PartitionHeader(FieldSet): static_size = 16*8 # taken from the source of cfdisk: # sed -n 's/.*{\(.*\), N_(\(.*\))}.*/ \1: \2,/p' i386_sys_types.c system_name = { 0x00: "Empty", 0x01: "FAT12", 0x02: "XENIX root", 0x03: "XENIX usr", 0x04: "FAT16 <32M", 0x05: "Extended", 0x06: "FAT16", 0x07: "HPFS/NTFS", 0x08: "AIX", 0x09: "AIX bootable", 0x0a: "OS/2 Boot Manager", 0x0b: "W95 FAT32", 0x0c: "W95 FAT32 (LBA)", 0x0e: "W95 FAT16 (LBA)", 0x0f: "W95 Ext'd (LBA)", 0x10: "OPUS", 0x11: "Hidden FAT12", 0x12: "Compaq diagnostics", 0x14: "Hidden FAT16 <32M", 0x16: "Hidden FAT16", 0x17: "Hidden HPFS/NTFS", 0x18: "AST SmartSleep", 0x1b: "Hidden W95 FAT32", 0x1c: "Hidden W95 FAT32 (LBA)", 0x1e: "Hidden W95 FAT16 (LBA)", 0x24: "NEC DOS", 0x39: "Plan 9", 0x3c: "PartitionMagic recovery", 0x40: "Venix 80286", 0x41: "PPC PReP Boot", 0x42: "SFS", 0x4d: "QNX4.x", 0x4e: "QNX4.x 2nd part", 0x4f: "QNX4.x 3rd part", 0x50: "OnTrack DM", 0x51: "OnTrack DM6 Aux1", 0x52: "CP/M", 0x53: "OnTrack DM6 Aux3", 0x54: "OnTrackDM6", 0x55: "EZ-Drive", 0x56: "Golden Bow", 0x5c: "Priam Edisk", 0x61: "SpeedStor", 0x63: "GNU HURD or SysV", 0x64: "Novell Netware 286", 0x65: "Novell Netware 386", 0x70: "DiskSecure Multi-Boot", 0x75: "PC/IX", 0x80: "Old Minix", 0x81: "Minix / old Linux", 0x82: "Linux swap / Solaris", 0x83: "Linux (ext2/ext3)", 0x84: "OS/2 hidden C: drive", 0x85: "Linux extended", 0x86: "NTFS volume set", 0x87: "NTFS volume set", 0x88: "Linux plaintext", 0x8e: "Linux LVM", 0x93: "Amoeba", 0x94: "Amoeba BBT", 0x9f: "BSD/OS", 0xa0: "IBM Thinkpad hibernation", 0xa5: "FreeBSD", 0xa6: "OpenBSD", 0xa7: "NeXTSTEP", 0xa8: "Darwin UFS", 0xa9: "NetBSD", 0xab: "Darwin boot", 0xb7: "BSDI fs", 0xb8: "BSDI swap", 0xbb: "Boot Wizard hidden", 0xbe: "Solaris boot", 0xbf: "Solaris", 0xc1: "DRDOS/sec (FAT-12)", 0xc4: "DRDOS/sec (FAT-16 < 32M)", 0xc6: "DRDOS/sec (FAT-16)", 0xc7: "Syrinx", 0xda: "Non-FS data", 0xdb: "CP/M / CTOS / ...", 0xde: "Dell Utility", 0xdf: "BootIt", 0xe1: "DOS access", 0xe3: "DOS R/O", 0xe4: "SpeedStor", 0xeb: "BeOS fs", 0xee: "EFI GPT", 0xef: "EFI (FAT-12/16/32)", 0xf0: "Linux/PA-RISC boot", 0xf1: "SpeedStor", 0xf4: "SpeedStor", 0xf2: "DOS secondary", 0xfd: "Linux raid autodetect", 0xfe: "LANstep", 0xff: "BBT" } def createFields(self): yield UInt8(self, "bootable", "Bootable flag (true if equals to 0x80)") if self["bootable"].value not in (0x00, 0x80): self.warning("Stream doesn't look like master boot record (partition bootable error)!") yield UInt8(self, "start_head", "Starting head number of the partition") yield Bits(self, "start_sector", 6, "Starting sector number of the partition") yield CylinderNumber(self, "start_cylinder", "Starting cylinder number of the partition") yield Enum(UInt8(self, "system", "System indicator"), self.system_name) yield UInt8(self, "end_head", "Ending head number of the partition") yield Bits(self, "end_sector", 6, "Ending sector number of the partition") yield CylinderNumber(self, "end_cylinder", "Ending cylinder number of the partition") yield UInt32(self, "LBA", "LBA (number of sectors before this partition)") yield UInt32(self, "size", "Size (block count)") def isUsed(self): return self["system"].value != 0 def createDescription(self): desc = "Partition header: " if self.isUsed(): system = self["system"].display size = self["size"].value * BLOCK_SIZE desc += "%s, %s" % (system, humanFilesize(size)) else: desc += "(unused)" return desc class MasterBootRecord(FieldSet): static_size = 512*8 def createFields(self): yield RawBytes(self, "program", 446, "Boot program (Intel x86 machine code)") yield PartitionHeader(self, "header[0]") yield PartitionHeader(self, "header[1]") yield PartitionHeader(self, "header[2]") yield PartitionHeader(self, "header[3]") yield textHandler(UInt16(self, "signature", "Signature (0xAA55)"), hexadecimal) def _getPartitions(self): return ( self[index] for index in xrange(1,5) ) headers = property(_getPartitions) class Partition(FieldSet): def createFields(self): mbr = MasterBootRecord(self, "mbr") yield mbr # No error if we only want to analyse a backup of a mbr if self.eof: return for start, index, header in sorted((hdr["LBA"].value, index, hdr) for index, hdr in enumerate(mbr.headers) if hdr.isUsed()): # Seek to the beginning of the partition padding = self.seekByte(start * BLOCK_SIZE, "padding[]") if padding: yield padding # Content of the partition name = "partition[%u]" % index size = BLOCK_SIZE * header["size"].value desc = header["system"].display if header["system"].value == 5: yield Partition(self, name, desc, size * 8) else: yield RawBytes(self, name, size, desc) # Padding at the end if self.current_size < self._size: yield self.seekBit(self._size, "end") class MSDos_HardDrive(Parser, Partition): endian = LITTLE_ENDIAN MAGIC = "\x55\xAA" PARSER_TAGS = { "id": "msdos_harddrive", "category": "file_system", "description": "MS-DOS hard drive with Master Boot Record (MBR)", "min_size": 512*8, "file_ext": ("",), # "magic": ((MAGIC, 510*8),), } def validate(self): if self.stream.readBytes(510*8, 2) != self.MAGIC: return "Invalid signature" used = False for hdr in self["mbr"].headers: if hdr["bootable"].value not in (0x00, 0x80): return "Wrong boot flag" used |= hdr.isUsed() return used or "No partition found"
7,808
Python
.py
206
29.519417
99
0.579385
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,642
psd.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/psd.pyc
Ñò Î ÈMc@sšdZddklZddklZlZlZlZlZl Z l Z ddk l Z ddk lZdefd„ƒYZdefd „ƒYZd S( sU Photoshop parser (.psd file). Creation date: 8 january 2006 Author: Victor Stinner iÿÿÿÿ(tParser(tFieldSettUInt16tUInt32tStringt NullBytestEnumtRawBytes(t BIG_ENDIAN(t Photoshop8BIMtConfigcBseZd„Zd„ZRS(cGs,ti||Œd|did|_dS(Nitsizei(Rt__init__tvaluet_size(tselftargs((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pyR sccs2t|dƒVx|ipt|dƒVqWdS(NR sitem[](RteofR (R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pyt createFieldss (t__name__t __module__R R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pyR s tPsdFilecBs©eZeZhdd6dd6d"d6d#d6d$d 6d&d6dd6Zhdd 6dd6dd6dd6dd 6dd6dd 6dd6Zhdd 6dd6Zd „Zd!„ZRS('tpsdtidtimagetcategorytfile_extu image/psduimage/photoshopuimage/x-photoshoptmimeiitmin_sizet8BPSitmagicsPhotoshop (PSD) picturet descriptionuBitmapu GrayscaleiuIndexediu RGB coloriu CMYK coloru MultichanneliuDuotoneu Lab Colori sRaw datatRLEcCs%|iiddƒdjodStS(Niit8BPSsInvalid signature(tstreamt readBytestTrue(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pytvalidate2sccsUt|dddddƒVt|dƒVt|ddƒVt|d ƒVt|d ƒVt|d ƒVt|d ƒVtt|d ƒ|iƒVt|dƒV|di}|ot|d|ƒVnt|dƒVt|dƒV|di}|ot|d|ƒVntt|dƒ|i ƒV|i |i d}|ot|d|ƒVndS(Nt signatureisPSD signature (8BPS)tcharsettASCIItversions reserved[]it nb_channelstwidththeighttdeptht color_modetmode_data_sizet mode_datatconfigtreserved_data_sizet reserved_datat compressionitend( RRRRRt COLOR_MODER RR tCOMPRESSION_NAMER t current_size(RR ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pyR7s*  (R(u image/psduimage/photoshopuimage/x-photoshopi (Ri((Ri( RRRtendiant PARSER_TAGSR6R7R%R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pyRs.    N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRthachoir_core.endianRt'hachoir_parser.image.photoshop_metadataR R R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/psd.pyt<module>s 4
3,505
Python
.py
25
139.12
596
0.469963
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,643
exif.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/exif.py
""" EXIF metadata parser (can be found in a JPEG picture for example) Author: Victor Stinner """ from hachoir_core.field import (FieldSet, ParserError, UInt8, UInt16, UInt32, Int32, Enum, String, Bytes, SubFile, NullBytes, createPaddingField) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN, NETWORK_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.tools import createDict MAX_COUNT = 1000 def rationalFactory(class_name, size, field_class): class Rational(FieldSet): static_size = size def createFields(self): yield field_class(self, "numerator") yield field_class(self, "denominator") def createValue(self): return float(self["numerator"].value) / self["denominator"].value cls = Rational cls.__name__ = class_name return cls RationalInt32 = rationalFactory("RationalInt32", 64, Int32) RationalUInt32 = rationalFactory("RationalUInt32", 64, UInt32) class BasicIFDEntry(FieldSet): TYPE_BYTE = 0 TYPE_UNDEFINED = 7 TYPE_RATIONAL = 5 TYPE_SIGNED_RATIONAL = 10 TYPE_INFO = { 1: (UInt8, "BYTE (8 bits)"), 2: (String, "ASCII (8 bits)"), 3: (UInt16, "SHORT (16 bits)"), 4: (UInt32, "LONG (32 bits)"), 5: (RationalUInt32, "RATIONAL (2x LONG, 64 bits)"), 7: (Bytes, "UNDEFINED (8 bits)"), 9: (Int32, "SIGNED LONG (32 bits)"), 10: (RationalInt32, "SRATIONAL (2x SIGNED LONGs, 64 bits)"), } ENTRY_FORMAT = createDict(TYPE_INFO, 0) TYPE_NAME = createDict(TYPE_INFO, 1) def createFields(self): yield Enum(textHandler(UInt16(self, "tag", "Tag"), hexadecimal), self.TAG_NAME) yield Enum(textHandler(UInt16(self, "type", "Type"), hexadecimal), self.TYPE_NAME) yield UInt32(self, "count", "Count") if self["type"].value not in (self.TYPE_BYTE, self.TYPE_UNDEFINED) \ and MAX_COUNT < self["count"].value: raise ParserError("EXIF: Invalid count value (%s)" % self["count"].value) value_size, array_size = self.getSizes() # Get offset/value if not value_size: yield NullBytes(self, "padding", 4) elif value_size <= 32: if 1 < array_size: name = "value[]" else: name = "value" kw = {} cls = self.value_cls if cls is String: args = (self, name, value_size/8, "Value") kw["strip"] = " \0" kw["charset"] = "ISO-8859-1" elif cls is Bytes: args = (self, name, value_size/8, "Value") else: args = (self, name, "Value") for index in xrange(array_size): yield cls(*args, **kw) size = array_size * value_size if size < 32: yield NullBytes(self, "padding", (32-size)//8) else: yield UInt32(self, "offset", "Value offset") def getSizes(self): """ Returns (value_size, array_size): value_size in bits and array_size in number of items. """ # Create format self.value_cls = self.ENTRY_FORMAT.get(self["type"].value, Bytes) # Set size count = self["count"].value if self.value_cls in (String, Bytes): return 8 * count, 1 else: return self.value_cls.static_size * count, count class ExifEntry(BasicIFDEntry): OFFSET_JPEG_SOI = 0x0201 EXIF_IFD_POINTER = 0x8769 TAG_WIDTH = 0xA002 TAG_HEIGHT = 0xA003 TAG_GPS_LATITUDE_REF = 0x0001 TAG_GPS_LATITUDE = 0x0002 TAG_GPS_LONGITUDE_REF = 0x0003 TAG_GPS_LONGITUDE = 0x0004 TAG_GPS_ALTITUDE_REF = 0x0005 TAG_GPS_ALTITUDE = 0x0006 TAG_GPS_TIMESTAMP = 0x0007 TAG_GPS_DATESTAMP = 0x001d TAG_IMG_TITLE = 0x010e TAG_FILE_TIMESTAMP = 0x0132 TAG_SOFTWARE = 0x0131 TAG_CAMERA_MODEL = 0x0110 TAG_CAMERA_MANUFACTURER = 0x010f TAG_ORIENTATION = 0x0112 TAG_EXPOSURE = 0x829A TAG_FOCAL = 0x829D TAG_BRIGHTNESS = 0x9203 TAG_APERTURE = 0x9205 TAG_USER_COMMENT = 0x9286 TAG_NAME = { # GPS 0x0000: "GPS version ID", 0x0001: "GPS latitude ref", 0x0002: "GPS latitude", 0x0003: "GPS longitude ref", 0x0004: "GPS longitude", 0x0005: "GPS altitude ref", 0x0006: "GPS altitude", 0x0007: "GPS timestamp", 0x0008: "GPS satellites", 0x0009: "GPS status", 0x000a: "GPS measure mode", 0x000b: "GPS DOP", 0x000c: "GPS speed ref", 0x000d: "GPS speed", 0x000e: "GPS track ref", 0x000f: "GPS track", 0x0010: "GPS img direction ref", 0x0011: "GPS img direction", 0x0012: "GPS map datum", 0x0013: "GPS dest latitude ref", 0x0014: "GPS dest latitude", 0x0015: "GPS dest longitude ref", 0x0016: "GPS dest longitude", 0x0017: "GPS dest bearing ref", 0x0018: "GPS dest bearing", 0x0019: "GPS dest distance ref", 0x001a: "GPS dest distance", 0x001b: "GPS processing method", 0x001c: "GPS area information", 0x001d: "GPS datestamp", 0x001e: "GPS differential", 0x0100: "Image width", 0x0101: "Image height", 0x0102: "Number of bits per component", 0x0103: "Compression scheme", 0x0106: "Pixel composition", TAG_ORIENTATION: "Orientation of image", 0x0115: "Number of components", 0x011C: "Image data arrangement", 0x0212: "Subsampling ratio Y to C", 0x0213: "Y and C positioning", 0x011A: "Image resolution width direction", 0x011B: "Image resolution in height direction", 0x0128: "Unit of X and Y resolution", 0x0111: "Image data location", 0x0116: "Number of rows per strip", 0x0117: "Bytes per compressed strip", 0x0201: "Offset to JPEG SOI", 0x0202: "Bytes of JPEG data", 0x012D: "Transfer function", 0x013E: "White point chromaticity", 0x013F: "Chromaticities of primaries", 0x0211: "Color space transformation matrix coefficients", 0x0214: "Pair of blank and white reference values", TAG_FILE_TIMESTAMP: "File change date and time", TAG_IMG_TITLE: "Image title", TAG_CAMERA_MANUFACTURER: "Camera (Image input equipment) manufacturer", TAG_CAMERA_MODEL: "Camera (Input input equipment) model", TAG_SOFTWARE: "Software", 0x013B: "File change date and time", 0x8298: "Copyright holder", 0x8769: "Exif IFD Pointer", TAG_EXPOSURE: "Exposure time", TAG_FOCAL: "F number", 0x8822: "Exposure program", 0x8824: "Spectral sensitivity", 0x8827: "ISO speed rating", 0x8828: "Optoelectric conversion factor OECF", 0x9201: "Shutter speed", 0x9202: "Aperture", TAG_BRIGHTNESS: "Brightness", 0x9204: "Exposure bias", TAG_APERTURE: "Maximum lens aperture", 0x9206: "Subject distance", 0x9207: "Metering mode", 0x9208: "Light source", 0x9209: "Flash", 0x920A: "Lens focal length", 0x9214: "Subject area", 0xA20B: "Flash energy", 0xA20C: "Spatial frequency response", 0xA20E: "Focal plane X resolution", 0xA20F: "Focal plane Y resolution", 0xA210: "Focal plane resolution unit", 0xA214: "Subject location", 0xA215: "Exposure index", 0xA217: "Sensing method", 0xA300: "File source", 0xA301: "Scene type", 0xA302: "CFA pattern", 0xA401: "Custom image processing", 0xA402: "Exposure mode", 0xA403: "White balance", 0xA404: "Digital zoom ratio", 0xA405: "Focal length in 35 mm film", 0xA406: "Scene capture type", 0xA407: "Gain control", 0xA408: "Contrast", 0x9000: "Exif version", 0xA000: "Supported Flashpix version", 0xA001: "Color space information", 0x9101: "Meaning of each component", 0x9102: "Image compression mode", TAG_WIDTH: "Valid image width", TAG_HEIGHT: "Valid image height", 0x927C: "Manufacturer notes", TAG_USER_COMMENT: "User comments", 0xA004: "Related audio file", 0x9003: "Date and time of original data generation", 0x9004: "Date and time of digital data generation", 0x9290: "DateTime subseconds", 0x9291: "DateTimeOriginal subseconds", 0x9292: "DateTimeDigitized subseconds", 0xA420: "Unique image ID", 0xA005: "Interoperability IFD Pointer" } def createDescription(self): return "Entry: %s" % self["tag"].display def sortExifEntry(a,b): return int( a["offset"].value - b["offset"].value ) class ExifIFD(FieldSet): def seek(self, offset): """ Seek to byte address relative to parent address. """ padding = offset - (self.address + self.current_size)/8 if 0 < padding: return createPaddingField(self, padding*8) else: return None def createFields(self): offset_diff = 6 yield UInt16(self, "count", "Number of entries") entries = [] next_chunk_offset = None count = self["count"].value if not count: return while count: addr = self.absolute_address + self.current_size next = self.stream.readBits(addr, 32, NETWORK_ENDIAN) if next in (0, 0xF0000000): break entry = ExifEntry(self, "entry[]") yield entry if entry["tag"].value in (ExifEntry.EXIF_IFD_POINTER, ExifEntry.OFFSET_JPEG_SOI): next_chunk_offset = entry["value"].value + offset_diff if 32 < entry.getSizes()[0]: entries.append(entry) count -= 1 yield UInt32(self, "next", "Next IFD offset") try: entries.sort( sortExifEntry ) except TypeError: raise ParserError("Unable to sort entries!") value_index = 0 for entry in entries: padding = self.seek(entry["offset"].value + offset_diff) if padding is not None: yield padding value_size, array_size = entry.getSizes() if not array_size: continue cls = entry.value_cls if 1 < array_size: name = "value_%s[]" % entry.name else: name = "value_%s" % entry.name desc = "Value of \"%s\"" % entry["tag"].display if cls is String: for index in xrange(array_size): yield cls(self, name, value_size/8, desc, strip=" \0", charset="ISO-8859-1") elif cls is Bytes: for index in xrange(array_size): yield cls(self, name, value_size/8, desc) else: for index in xrange(array_size): yield cls(self, name, desc) value_index += 1 if next_chunk_offset is not None: padding = self.seek(next_chunk_offset) if padding is not None: yield padding def createDescription(self): return "Exif IFD (id %s)" % self["id"].value class Exif(FieldSet): def createFields(self): # Headers yield String(self, "header", 6, "Header (Exif\\0\\0)", charset="ASCII") if self["header"].value != "Exif\0\0": raise ParserError("Invalid EXIF signature!") yield String(self, "byte_order", 2, "Byte order", charset="ASCII") if self["byte_order"].value not in ("II", "MM"): raise ParserError("Invalid endian!") if self["byte_order"].value == "II": self.endian = LITTLE_ENDIAN else: self.endian = BIG_ENDIAN yield UInt16(self, "version", "TIFF version number") yield UInt32(self, "img_dir_ofs", "Next image directory offset") while not self.eof: addr = self.absolute_address + self.current_size tag = self.stream.readBits(addr, 16, NETWORK_ENDIAN) if tag == 0xFFD8: size = (self._size - self.current_size) // 8 yield SubFile(self, "thumbnail", size, "Thumbnail (JPEG file)", mime_type="image/jpeg") break elif tag == 0xFFFF: break yield ExifIFD(self, "ifd[]", "IFD") padding = self.seekBit(self._size) if padding is not None: yield padding
12,794
Python
.py
328
29.536585
103
0.586343
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,644
common.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/common.pyc
Ñò Î ÈMc@sxddklZlZlZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd S( iÿÿÿÿ(tFieldSett UserVectortUInt8tRGBcBsIeZhdd 6dd 6dd 6dd 6dd6ZdZd„Zd „ZRS(tBlackitRediÿtGreentBluetWhiteiccs7t|ddƒVt|ddƒVt|ddƒVdS(NtredRtgreenRtblueR(R(tself((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyt createFields scCsS|di|di|dif}|ii|ƒ}|pd|}nd|S(NR R R s #%02X%02X%02Xs RGB color: (tvaluet color_nametget(R trgbtname((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pytcreateDescriptions $(iii(iÿii(iiÿi(iiiÿ(iÿiÿiÿ(t__name__t __module__Rt static_sizeR R(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyRs  tRGBAcBs eZdZd„Zd„ZRS(i ccsHt|ddƒVt|ddƒVt|ddƒVt|ddƒVdS( NR RR RR RtalphatAlpha(R(R ((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyR scCs2ti|ƒ}|didd}d||fS(NRidiÿs%s (opacity: %s%%)(RRR(R t descriptiontopacity((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyR"s(RRRR R(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyRs t PaletteRGBcBseZeZdZd„ZRS(tcolorcCsdt|ƒS(NsPalette of %u RGB colors(tlen(R ((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyR*s(RRRt item_classt item_nameR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyR'st PaletteRGBAcBseZeZd„ZRS(cCsdt|ƒS(NsPalette of %u RGBA colors(R(R ((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyR/s(RRRRR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyR!-sN(thachoir_core.fieldRRRRRRR!(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/image/common.pyt<module>s
3,055
Python
.py
13
234
719
0.441341
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,645
bmp.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/bmp.pyc
Ñò Î ÈMc @s?dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZddklZddklZlZddklZlZddklZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZd„Zdefd„ƒYZdS(sn Microsoft Bitmap picture parser. - file extension: ".bmp" Author: Victor Stinner Creation: 16 december 2005 iÿÿÿÿ(tParser( tFieldSettUInt8tUInt16tUInt32tBitstStringtRawBytestEnumt PaddingBytest NullBytestcreatePaddingField(t LITTLE_ENDIAN(t textHandlert hexadecimal(tRGBt PaletteRGBA(t alignValuet Pixel4bitcBseZdZd„ZRS(icCsti|||dƒdS(Ni(Rt__init__(tselftparenttname((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyRs(t__name__t __module__t static_sizeR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyRst ImageLinecBseZd„Zd„ZRS(cCsHti|||ƒ||_||_t|i|iidƒ|_dS(Ni (RRt_pixelt_widthRRt_size(RRRtwidtht pixel_class((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyRs  ccsXx(t|iƒD]}|i|dƒVqW|i|i}|ot||ƒVndS(Nspixel[](txrangeRRtsizet current_sizeR (RtxR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyt createFieldss (RRRR$(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyRs t ImagePixelscBseZdd„Zd„ZRS(cCs8ti|||d|ƒ||_||_||_dS(NR!(RRRt_heightR(RRRRtheightRR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR's  ccsvx?t|idddƒD]$}t|d||i|iƒVqW|i|id}|ot|d|ƒVndS(Niiÿÿÿÿsline[%u]itpadding(R R&RRRR!R"R (RtyR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR$-s "N(RRtNoneRR$(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR%&s tCIEXYZcBseZd„ZRS(ccs.t|dƒVt|dƒVt|dƒVdS(NR#R)tz(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR$5s(RRR$(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR+4st BmpHeadercBs<eZhdd6dd6dd6dd6Zd„Zd „ZRS( sBusiness (Saturation)isGraphics (Relative)isImages (Perceptual)isAbsolute colormetric (Absolute)icCs(d|jodSd|jodSdS(Nt gamma_blueitimportant_colorii((R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pytgetFormatVersionBs   ccsÇt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d ƒV|did jodStt|d d ƒtiƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒV|didjodStt|dƒtƒVtt|dƒtƒVtt|dƒtƒVtt|dƒtƒVtt|dƒ|iƒVt |dƒVt |dƒVt |d ƒVt|d!ƒVt|d"ƒVt|d#ƒVdS($Nt header_sizes Header sizeRsWidth (pixels)R'sHeight (pixels)tnb_plansNumber of plan (=1)tbppsBits per pixeli(t compressionsCompression methodt image_sizesImage size (bytes)thorizontal_dpisHorizontal DPIt vertical_dpis Vertical DPIt used_colorssNumber of color usedR/sNumber of import colorsiltred_maskt green_maskt blue_maskt alpha_maskt color_spacet red_primaryt green_primaryt blue_primaryt gamma_redt gamma_greenR.( RRtvalueRtBmpFiletCOMPRESSION_NAMER Rtcolor_space_nameR+(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR$Is4(RRRFR0R$(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR-:s  c Csæd|jp|did joµ|di}|di}|di}|djo t}nL|djo t}n5|d jo t}n|d jo t}nd}|o!t|||||d |d ƒSnt|||ƒS( NR4iiRR'R3i iiiR!(ii(RCRRRRR*R%R(RRR!theaderRR'R3tcls((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pytparseImageDatajs !           %RDcBs™eZhdd6dd6dd6d d6d!d 6d#d 6dd6ZeZhdd 6dd6dd6dd6dd6dd6Zd„Zd„Zd„Zd„Z RS($tbmptidtimagetcategorytfile_extuimage/x-ms-bmpu image/x-bmptmimeiitmin_sizesBM.{4}.{8}[ (l]{3}it magic_regexsMicrosoft bitmap (BMP) picturet descriptionu Uncompressedu RLE 8-bitiu RLE 4-bitiu BitfieldsiuJPEGiuPNGicCsb|iiddƒdjodS|didjod |d iS|d id jod StS(NiitBMsWrong file signaturesheader/header_sizei i(ilsUnknown header size (%s)R1sheader/nb_planisInvalid number of planes(i i(il(tstreamt readBytesRCtTrue(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pytvalidate–sccs\t|dddddƒVt|ddƒVt|dd d ƒVt|d d ƒVt|d ƒV|d }|di}d|jo djno:d|jo|dio|di}qÓd|>}nd}|ot|d|ƒVn|i|d iƒ}|o |Vnt|di|d i|i|i dƒ}t |d||ƒVdS(Nt signatureis Header ("BM")tcharsettASCIIt file_sizesFile size (bytes)treserveditReservedt data_startsData start positionRGR3iiR8itpalettetpixels( RRR R-RCRtseekBytetminR!R"RI(RRGR3tnb_colortfieldR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyR$Ÿs&   /cCsd|diƒS(NuMicrosoft Bitmap version %sRG(R0(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pytcreateDescription¾scCs|didS(NR[i(RC(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pytcreateContentSizeÁs(RJ(uimage/x-ms-bmpu image/x-bmpið(sBM.{4}.{8}[ (l]{3}i((sBM.{4}.{8}[ (l]{3}i( RRt PARSER_TAGSR tendianRERWR$ReRf(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyRD}s*    N( t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R thachoir_core.endianR thachoir_core.text_handlerR Rthachoir_parser.image.commonRRthachoir_core.toolsRRRR%R+R-RIRD(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/bmp.pyt<module>sL0 
8,726
Python
.py
42
206.738095
1,544
0.441271
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,646
jpeg.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/jpeg.py
""" JPEG picture parser. Information: - APP14 documents http://partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color - APP12: http://search.cpan.org/~exiftool/Image-ExifTool/lib/Image/ExifTool/TagNames.pod Author: Victor Stinner """ from hachoir_core.error import HachoirError from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, UInt8, UInt16, Enum, Bit, Bits, NullBits, NullBytes, String, RawBytes) from hachoir_parser.image.common import PaletteRGB from hachoir_core.endian import BIG_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_parser.image.exif import Exif from hachoir_parser.image.photoshop_metadata import PhotoshopMetadata MAX_FILESIZE = 100 * 1024 * 1024 # The four tables (hash/sum for color/grayscale JPEG) comes # from ImageMagick project QUALITY_HASH_COLOR = ( 1020, 1015, 932, 848, 780, 735, 702, 679, 660, 645, 632, 623, 613, 607, 600, 594, 589, 585, 581, 571, 555, 542, 529, 514, 494, 474, 457, 439, 424, 410, 397, 386, 373, 364, 351, 341, 334, 324, 317, 309, 299, 294, 287, 279, 274, 267, 262, 257, 251, 247, 243, 237, 232, 227, 222, 217, 213, 207, 202, 198, 192, 188, 183, 177, 173, 168, 163, 157, 153, 148, 143, 139, 132, 128, 125, 119, 115, 108, 104, 99, 94, 90, 84, 79, 74, 70, 64, 59, 55, 49, 45, 40, 34, 30, 25, 20, 15, 11, 6, 4, 0) QUALITY_SUM_COLOR = ( 32640,32635,32266,31495,30665,29804,29146,28599,28104,27670, 27225,26725,26210,25716,25240,24789,24373,23946,23572,22846, 21801,20842,19949,19121,18386,17651,16998,16349,15800,15247, 14783,14321,13859,13535,13081,12702,12423,12056,11779,11513, 11135,10955,10676,10392,10208, 9928, 9747, 9564, 9369, 9193, 9017, 8822, 8639, 8458, 8270, 8084, 7896, 7710, 7527, 7347, 7156, 6977, 6788, 6607, 6422, 6236, 6054, 5867, 5684, 5495, 5305, 5128, 4945, 4751, 4638, 4442, 4248, 4065, 3888, 3698, 3509, 3326, 3139, 2957, 2775, 2586, 2405, 2216, 2037, 1846, 1666, 1483, 1297, 1109, 927, 735, 554, 375, 201, 128, 0) QUALITY_HASH_GRAY = ( 510, 505, 422, 380, 355, 338, 326, 318, 311, 305, 300, 297, 293, 291, 288, 286, 284, 283, 281, 280, 279, 278, 277, 273, 262, 251, 243, 233, 225, 218, 211, 205, 198, 193, 186, 181, 177, 172, 168, 164, 158, 156, 152, 148, 145, 142, 139, 136, 133, 131, 129, 126, 123, 120, 118, 115, 113, 110, 107, 105, 102, 100, 97, 94, 92, 89, 87, 83, 81, 79, 76, 74, 70, 68, 66, 63, 61, 57, 55, 52, 50, 48, 44, 42, 39, 37, 34, 31, 29, 26, 24, 21, 18, 16, 13, 11, 8, 6, 3, 2, 0) QUALITY_SUM_GRAY = ( 16320,16315,15946,15277,14655,14073,13623,13230,12859,12560, 12240,11861,11456,11081,10714,10360,10027, 9679, 9368, 9056, 8680, 8331, 7995, 7668, 7376, 7084, 6823, 6562, 6345, 6125, 5939, 5756, 5571, 5421, 5240, 5086, 4976, 4829, 4719, 4616, 4463, 4393, 4280, 4166, 4092, 3980, 3909, 3835, 3755, 3688, 3621, 3541, 3467, 3396, 3323, 3247, 3170, 3096, 3021, 2952, 2874, 2804, 2727, 2657, 2583, 2509, 2437, 2362, 2290, 2211, 2136, 2068, 1996, 1915, 1858, 1773, 1692, 1620, 1552, 1477, 1398, 1326, 1251, 1179, 1109, 1031, 961, 884, 814, 736, 667, 592, 518, 441, 369, 292, 221, 151, 86, 64, 0) JPEG_NATURAL_ORDER = ( 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63) class JpegChunkApp0(FieldSet): UNIT_NAME = { 0: "pixels", 1: "dots per inch", 2: "dots per cm", } def createFields(self): yield String(self, "jfif", 5, "JFIF string", charset="ASCII") if self["jfif"].value != "JFIF\0": raise ParserError( "Stream doesn't look like JPEG chunk (wrong JFIF signature)") yield UInt8(self, "ver_maj", "Major version") yield UInt8(self, "ver_min", "Minor version") yield Enum(UInt8(self, "units", "Units"), self.UNIT_NAME) if self["units"].value == 0: yield UInt16(self, "aspect_x", "Aspect ratio (X)") yield UInt16(self, "aspect_y", "Aspect ratio (Y)") else: yield UInt16(self, "x_density", "X density") yield UInt16(self, "y_density", "Y density") yield UInt8(self, "thumb_w", "Thumbnail width") yield UInt8(self, "thumb_h", "Thumbnail height") thumb_size = self["thumb_w"].value * self["thumb_h"].value if thumb_size != 0: yield PaletteRGB(self, "thumb_palette", 256) yield RawBytes(self, "thumb_data", thumb_size, "Thumbnail data") class Ducky(FieldSet): BLOCK_TYPE = { 0: "end", 1: "Quality", 2: "Comment", 3: "Copyright", } def createFields(self): yield Enum(UInt16(self, "type"), self.BLOCK_TYPE) if self["type"].value == 0: return yield UInt16(self, "size") size = self["size"].value if size: yield RawBytes(self, "data", size) class APP12(FieldSet): """ The JPEG APP12 "Picture Info" segment was used by some older cameras, and contains ASCII-based meta information. """ def createFields(self): yield String(self, "ducky", 5, '"Ducky" string', charset="ASCII") while not self.eof: yield Ducky(self, "item[]") class StartOfFrame(FieldSet): def createFields(self): yield UInt8(self, "precision") yield UInt16(self, "height") yield UInt16(self, "width") yield UInt8(self, "nr_components") for index in range(self["nr_components"].value): yield UInt8(self, "component_id[]") yield UInt8(self, "high[]") yield UInt8(self, "low[]") class Comment(FieldSet): def createFields(self): yield String(self, "comment", self.size//8, strip="\0") class AdobeChunk(FieldSet): COLORSPACE_TRANSFORMATION = { 1: "YCbCr (converted from RGB)", 2: "YCCK (converted from CMYK)", } def createFields(self): if self.stream.readBytes(self.absolute_address, 5) != "Adobe": yield RawBytes(self, "raw", self.size//8, "Raw data") return yield String(self, "adobe", 5, "\"Adobe\" string", charset="ASCII") yield UInt16(self, "version", "DCT encoder version") yield Enum(Bit(self, "flag00"), {False: "Chop down or subsampling", True: "Blend"}) yield NullBits(self, "flags0_reserved", 15) yield NullBytes(self, "flags1", 2) yield Enum(UInt8(self, "color_transform", "Colorspace transformation code"), self.COLORSPACE_TRANSFORMATION) class StartOfScan(FieldSet): def createFields(self): yield UInt8(self, "nr_components") for index in range(self["nr_components"].value): comp_id = UInt8(self, "component_id[]") yield comp_id if not(1 <= comp_id.value <= self["nr_components"].value): raise ParserError("JPEG error: Invalid component-id") yield UInt8(self, "value[]") yield RawBytes(self, "raw", 3) # TODO: What's this??? class RestartInterval(FieldSet): def createFields(self): yield UInt16(self, "interval", "Restart interval") class QuantizationTable(FieldSet): def createFields(self): # Code based on function get_dqt() (jdmarker.c from libjpeg62) yield Bits(self, "is_16bit", 4) yield Bits(self, "index", 4) if self["index"].value >= 4: raise ParserError("Invalid quantification index (%s)" % self["index"].value) if self["is_16bit"].value: coeff_type = UInt16 else: coeff_type = UInt8 for index in xrange(64): natural = JPEG_NATURAL_ORDER[index] yield coeff_type(self, "coeff[%u]" % natural) def createDescription(self): return "Quantification table #%u" % self["index"].value class DefineQuantizationTable(FieldSet): def createFields(self): while self.current_size < self.size: yield QuantizationTable(self, "qt[]") class JpegChunk(FieldSet): TAG_SOI = 0xD8 TAG_EOI = 0xD9 TAG_SOS = 0xDA TAG_DQT = 0xDB TAG_DRI = 0xDD TAG_INFO = { 0xC4: ("huffman[]", "Define Huffman Table (DHT)", None), 0xD8: ("start_image", "Start of image (SOI)", None), 0xD9: ("end_image", "End of image (EOI)", None), 0xDA: ("start_scan", "Start Of Scan (SOS)", StartOfScan), 0xDB: ("quantization[]", "Define Quantization Table (DQT)", DefineQuantizationTable), 0xDC: ("nb_line", "Define number of Lines (DNL)", None), 0xDD: ("restart_interval", "Define Restart Interval (DRI)", RestartInterval), 0xE0: ("app0", "APP0", JpegChunkApp0), 0xE1: ("exif", "Exif metadata", Exif), 0xEC: ("app12", "APP12", APP12), 0xED: ("photoshop", "Photoshop", PhotoshopMetadata), 0xEE: ("adobe", "Image encoding information for DCT filters (Adobe)", AdobeChunk), 0xFE: ("comment[]", "Comment", Comment), } START_OF_FRAME = { 0xC0: u"Baseline", 0xC1: u"Extended sequential", 0xC2: u"Progressive", 0xC3: u"Lossless", 0xC5: u"Differential sequential", 0xC6: u"Differential progressive", 0xC7: u"Differential lossless", 0xC9: u"Extended sequential, arithmetic coding", 0xCA: u"Progressive, arithmetic coding", 0xCB: u"Lossless, arithmetic coding", 0xCD: u"Differential sequential, arithmetic coding", 0xCE: u"Differential progressive, arithmetic coding", 0xCF: u"Differential lossless, arithmetic coding", } for key, text in START_OF_FRAME.iteritems(): TAG_INFO[key] = ("start_frame", "Start of frame (%s)" % text.lower(), StartOfFrame) def __init__(self, parent, name, description=None): FieldSet.__init__(self, parent, name, description) tag = self["type"].value if tag == 0xE1: # Hack for Adobe extension: XAP metadata (as XML) bytes = self.stream.readBytes(self.absolute_address + 32, 6) if bytes == "Exif\0\0": self._name = "exif" self._description = "EXIF" self._parser = Exif else: self._parser = None elif tag in self.TAG_INFO: self._name, self._description, self._parser = self.TAG_INFO[tag] else: self._parser = None def createFields(self): yield textHandler(UInt8(self, "header", "Header"), hexadecimal) if self["header"].value != 0xFF: raise ParserError("JPEG: Invalid chunk header!") yield textHandler(UInt8(self, "type", "Type"), hexadecimal) tag = self["type"].value if tag in (self.TAG_SOI, self.TAG_EOI): return yield UInt16(self, "size", "Size") size = (self["size"].value - 2) if 0 < size: if self._parser: yield self._parser(self, "content", "Chunk content", size=size*8) else: yield RawBytes(self, "data", size, "Data") def createDescription(self): return "Chunk: %s" % self["type"].display class JpegFile(Parser): endian = BIG_ENDIAN PARSER_TAGS = { "id": "jpeg", "category": "image", "file_ext": ("jpg", "jpeg"), "mime": (u"image/jpeg",), "magic": ( ("\xFF\xD8\xFF\xE0", 0), # (Start Of Image, APP0) ("\xFF\xD8\xFF\xE1", 0), # (Start Of Image, EXIF) ("\xFF\xD8\xFF\xEE", 0), # (Start Of Image, Adobe) ), "min_size": 22*8, "description": "JPEG picture", "subfile": "skip", } def validate(self): if self.stream.readBytes(0, 2) != "\xFF\xD8": return "Invalid file signature" try: for index, field in enumerate(self): chunk_type = field["type"].value if chunk_type not in JpegChunk.TAG_INFO: return "Unknown chunk type: 0x%02X (chunk #%s)" % (chunk_type, index) if index == 2: # Only check 3 fields break except HachoirError: return "Unable to parse at least three chunks" return True def createFields(self): while not self.eof: chunk = JpegChunk(self, "chunk[]") yield chunk if chunk["type"].value == JpegChunk.TAG_SOS: # TODO: Read JPEG image data... break # TODO: is it possible to handle piped input? if self._size is None: raise NotImplementedError has_end = False size = (self._size - self.current_size) // 8 if size: if 2 < size \ and self.stream.readBytes(self._size - 16, 2) == "\xff\xd9": has_end = True size -= 2 yield RawBytes(self, "data", size, "JPEG data") if has_end: yield JpegChunk(self, "chunk[]") def createDescription(self): desc = "JPEG picture" if "sof/content" in self: header = self["sof/content"] desc += ": %ux%u pixels" % (header["width"].value, header["height"].value) return desc def createContentSize(self): if "end" in self: return self["end"].absolute_address + self["end"].size if "data" not in self: return None start = self["data"].absolute_address end = self.stream.searchBytes("\xff\xd9", start, MAX_FILESIZE*8) if end is not None: return end + 16 return None
14,287
Python
.py
330
34.984848
116
0.580963
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,647
ico.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/ico.py
""" Microsoft Windows icon and cursor file format parser. Author: Victor Stinner """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, UInt8, UInt16, UInt32, Enum, RawBytes) from hachoir_parser.image.common import PaletteRGBA from hachoir_core.endian import LITTLE_ENDIAN from hachoir_parser.common.win32 import BitmapInfoHeader class IconHeader(FieldSet): def createFields(self): yield UInt8(self, "width", "Width") yield UInt8(self, "height", "Height") yield UInt8(self, "nb_color", "Number of colors") yield UInt8(self, "reserved", "(reserved)") yield UInt16(self, "planes", "Color planes (=1)") yield UInt16(self, "bpp", "Bits per pixel") yield UInt32(self, "size", "Content size in bytes") yield UInt32(self, "offset", "Data offset") def createDescription(self): return "Icon: %ux%u pixels, %u bits/pixel" % \ (self["width"].value, self["height"].value, self["bpp"].value) def isValid(self): if self["nb_color"].value == 0: if self["bpp"].value in (8, 24, 32) and self["planes"].value == 1: return True if self["planes"].value == 4 and self["bpp"].value == 0: return True elif self["nb_color"].value == 16: if self["bpp"].value in (4, 16) and self["planes"].value == 1: return True else: return False if self["bpp"].value == 0 and self["planes"].value == 0: return True return False class IconData(FieldSet): def __init__(self, parent, name, header): FieldSet.__init__(self, parent, name, "Icon data") self.header = header def createFields(self): yield BitmapInfoHeader(self, "header") # Read palette if needed nb_color = self.header["nb_color"].value if self.header["bpp"].value == 8: nb_color = 256 if nb_color != 0: yield PaletteRGBA(self, "palette", nb_color) # Read pixels size = self.header["size"].value - self.current_size/8 yield RawBytes(self, "pixels", size, "Image pixels") class IcoFile(Parser): endian = LITTLE_ENDIAN PARSER_TAGS = { "id": "ico", "category": "image", "file_ext": ("ico", "cur"), "mime": (u"image/x-ico",), "min_size": (22 + 40)*8, # "magic": ( # ("\0\0\1\0", 0), # Icon # ("\0\0\2\0", 0), # Cursor # ), "magic_regex": (( # signature=0, type=(1|2), count in 1..20, "\0\0[\1\2]\0[\x01-\x14]." # size=(16x16|32x32|48x48|64x64), "(\x10\x10|\x20\x20|\x30\x30|\x40\x40)" # nb_color=0 or 16; nb_plane=(0|1|4), bpp=(0|8|24|32) "[\x00\x10]\0[\0\1\4][\0\x08\x18\x20]\0", 0),), "description": "Microsoft Windows icon or cursor", } TYPE_NAME = { 1: "icon", 2: "cursor" } def validate(self): # Check signature and type if self["signature"].value != 0: return "Wrong file signature" if self["type"].value not in self.TYPE_NAME: return "Unknown picture type" # Check all icon headers index = -1 for field in self: if field.name.startswith("icon_header"): index += 1 if not field.isValid(): return "Invalid header #%u" % index elif 0 <= index: break return True def createFields(self): yield UInt16(self, "signature", "Signature (0x0000)") yield Enum(UInt16(self, "type", "Resource type"), self.TYPE_NAME) yield UInt16(self, "nb_items", "Number of items") items = [] for index in xrange(self["nb_items"].value): item = IconHeader(self, "icon_header[]") yield item items.append(item) for header in items: if header["offset"].value*8 != self.current_size: raise ParserError("Icon: Problem with icon data offset.") yield IconData(self, "icon_data[]", header) def createDescription(self): desc = "Microsoft Windows %s" % self["type"].display size = [] for header in self.array("icon_header"): size.append("%ux%ux%u" % (header["width"].value, header["height"].value, header["bpp"].value)) if size: return "%s: %s" % (desc, ", ".join(size)) else: return desc def createContentSize(self): count = self["nb_items"].value if not count: return None field = self["icon_data[%u]" % (count-1)] return field.absolute_address + field.size
4,815
Python
.py
123
30.04878
78
0.555817
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,648
wmf.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/wmf.pyc
—Ú Œ »Mc @s< dZdZddklZddklZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZddklZddklZlZddklZdd klZhd d 6d d 6Zh dd6dd 6dd 6dd6dd6dd6dd6dd6dd6Zhdd6dd 6d d 6d!d6d"d6d#d6Zh dd6d$d 6d%d 6d&d6d'd6dd6d(d6d)d6d*d6Zhd+d 6d,d 6d-d6d.d6d/d6d0d6d1d6d2d6d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6ZdCÑZ dDÑZ!dEÑZ"dFÑZ#dGÑZ$dHÑZ%dIefdJÑÉYZ&dKÑZ'h?dd6ddP6ddS6ddV6ddY6dd\6dd_6d`dae$fdb6dcdde#fde6ddh6ddk6ddn6d dq6d!dt6d"dw6dxdye%fdz6d#d}6d$dÄ6dÅdÇe%fdÉ6d%dÜ6d&dâ6d'då6dçdée fdè6dêdëe fdí6d(dï6d)dò6d*dõ6d+dû6d,d°6d-d§6d.dß6d/d™6d0d≠6d1d∞6d2d≥6d¥dµe"fd∂6d∑d∏e!fdπ6d∫dªe'fdº6d3dø6d4d¬6d5d≈6d6d»6d7dÀ6d8dŒ6d9d—6d:d‘6d;d◊6d<d⁄6d=d›6d>d‡6d?d„6d@dÊ6dAdÈ6dBdÏ6dCdÔ6dDdÚ6dEdı6dFd¯6dGd˚6dHd˛6dId6dJd6dKd6Z)ee)dÉZ*ee)d ÉZ+hdd 6d d 6d d6d d6d d6d d6dd6dd6Z,dÑZ-dÑZ.dÑZ/dÑZ0defdÑÉYZ1dÑZ2dÑZ3dÑZ4dÑZ5hgdLd 6dMd 6dNd6dOd6dPd6dQd6dRd6dSd6d'd(e.fd46d)d*e.fd66d+d,e.fd86d-d.e.fd:6dTd<6dUd>6dVd@6dWdB6d]d^e-fd36dXd46dYd66dZd86d[d:6d\d<6d]d?6d^d@6d_dA6d`dC6dDdEe.fdF6dadI6dbdJ6dcdP6dddM6dedP6dfdQ6dgdR6dhdU6didX6dxdye/fdY6djd\6d∑d∏e0fd]6dÅdÇe/fd^6dkda6dldc6dmde6dndg6dodi6dpdk6dqdm6drdn6dsdo6dtd6duds6dvdt6dwdS6düdve.fdw6dxdV6dyd|6dzd6d{dÇ6d|dÖ6d}dà6d~dã6ddé6dÄdë6dÅdî6dÇdó6dÉdö6dÑdù6dÖd†6d°d¢e3fd£6dÜd•6dád®6dàd™6dâd¨6dädØ6dãd≤6dådµ6dçd∏6dédª6dèdæ6dêd¡6dëdƒ6díd«6dìd 6dîdÕ6dŒdœe2fd–6d—d“e2fd”6d‘d’e2fd÷6d◊dÿe2fdŸ6dïd‹6d›dfie2fdfl6dñd‚6dódÂ6dòdË6dÈdÍe5fdÎ6dôdÓ6dödÒ6dÚdÛe4fdÙ6dõd˜6dúd˙6dùd˝6dûd6düd6d†d6Z6ee6dÉZ7ee6d ÉZ8defdÑÉYZ9d efd ÑÉYZ:d e:fd ÑÉYZ;d efdÑÉYZ<defdÑÉYZ=defdÑÉYZ>dS(°sç Hachoir parser of Microsoft Windows Metafile (WMF) file format. Documentation: - Microsoft Windows Metafile; also known as: WMF, Enhanced Metafile, EMF, APM http://wvware.sourceforge.net/caolan/ora-wmf.html - libwmf source code: - include/libwmf/defs.h: enums - src/player/meta.h: arguments parsers - libemf source code Author: Victor Stinner Creation date: 26 december 2006 i2iiˇˇˇˇ(tParser( tFieldSettStaticFieldSettEnumt MissingFieldt ParserErrortUInt32tInt32tUInt16tInt16tUInt8t NullBytestRawBytestString(t LITTLE_ENDIAN(t textHandlert hexadecimal(t createDict(tRGBAt AlternateitWindingiuSolidiuNulluHollowuPatterniuIndexediu DIB patterniuDIB pattern pointiu Pattern 8x8iuDIB pattern 8x8iu HorizontaluVerticalu FDIAGONALu BDIAGONALuCrossuDiagonal crossuDashuDotuDash dotu Dash dot dotu Inside frameu User styleu Alternateu Black (0)uNot merge pen (DPon)uMask not pen (DPna)uNot copy pen (PN)uMask pen not (PDna)uNot (Dn)u Xor pen (DPx)uNot mask pen (DPan)uMask pen (DPa)i uNot xor pen (DPxn)i uNo operation (D)i uMerge not pen (DPno)i u Copy pen (P)i uMerge pen not (PDno)iuMerge pen (DPo)iu White (1)iccs t|dÉVt|dÉVdS(Ntxty(R (tparser((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseXYSsccs@tt|dÉtÉVt|dÉVtt|dÉtÉVdS(Nt brush_styletcolort brush_hatch(RRt BRUSH_STYLERt HATCH_STYLE(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseCreateBrushIndirectWsccsEtt|dÉtÉVt|dÉVt|dÉVt|dÉVdS(Nt pen_stylet pen_widtht pen_heightR(RRt PEN_STYLER(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparsePenIndirect\sccstt|dÉtÉVdS(Nt operation(RRt POLYFILL_MODE(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparsePolyFillModebsccstt|dÉtÉVdS(NR$(RRt ROP2_DESC(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt parseROP2esccst|dÉVdS(Nt object_id(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt parseObjectIDhstPointcBs eZdZdÑZdÑZRS(i ccs t|dÉVt|dÉVdS(NRR(R (tself((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt createFieldsmscCsd|di|difS(NsPoint (%s, %s)RR(tvalue(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytcreateDescriptionps(t__name__t __module__t static_sizeR-R/(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR+ks ccs>t|dÉVx)t|diÉD]}t|dÉVq"WdS(Ntcountspoint[](RtxrangeR.R+(Rtindex((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt parsePolygonsstEOFu End of filetSAVEDCuSave device contextitREALIZEPALETTEuRealize palettei5t SETPALENTRIESuSet palette entriesi7t CREATEPALETTEuCreate palettei˜t SETBKMODEuSet background modeit SETMAPMODEuSet mapping modeitSETROP2uSet foreground mix modeitSETPOLYFILLMODEuSet polygon fill modeitSETSTRETCHBLTMODEuSet bitmap streching modeitSETTEXTCHAREXTRAuSet text character extrait RESTOREDCuRestore device contexti't INVERTREGIONu Invert regioni*t PAINTREGIONu Paint regioni+tSELECTCLIPREGIONuSelect clipping regioni,t SELECTOBJECTu Select objecti-t SETTEXTALIGNuSet text alignmenti.tCREATEDIBPATTERNBRUSHu'Create DIB brush with specified patterniBt DELETEOBJECTu Delete objectit SETBKCOLORuSet background colorit SETTEXTCOLORuSet text colori tSETTEXTJUSTIFICATIONuSet text justificationi t SETWINDOWORGuSet window origini t SETWINDOWEXTuSet window extendsi tSETVIEWPORTORGuSet view port origini tSETVIEWPORTEXTuSet view port extendsitOFFSETWINDOWORGuOffset window originitOFFSETVIEWPORTORGuOffset view port originitLINETOuDraw a line toitMOVETOuMove toit OFFSETCLIPRGNuOffset clipping rectanglei t FILLREGIONu Fill regioni(tSETMAPPERFLAGSuSet mapper flagsi1t SELECTPALETTEuSelect palettei4tCREATEFONTINDIRECTuCreate font indirecti˚tCREATEPENINDIRECTuCreate pen indirecti˙tCREATEBRUSHINDIRECTuCreate brush indirecti¸tPOLYGONuDraw a polygoni$tPOLYLINEuDraw a polylinei%tSCALEWINDOWEXTuScale window extendsitSCALEVIEWPORTEXTuScale view port extendsitEXCLUDECLIPRECTuExclude clipping rectangleitINTERSECTCLIPRECTuIntersect clipping rectangleitELLIPSEuDraw an ellipseit FLOODFILLu Flood fillit RECTANGLEuDraw a rectangleitSETPIXELu Set pixelit FRAMEREGIONu Fram regioni)tTEXTOUTu Draw texti!t POLYPOLYGONuDraw multiple polygonsi8t EXTFLOODFILLuExtend flood filliHt ROUNDRECTuDraw a rounded rectangleitPATBLTuPattern blittingitESCAPEuEscapei&t CREATEREGIONu Create regioniˇtARCu Draw an arcitPIEu Draw a pieitCHORDu Draw a chordi0t DIBBITBLTuDIB bit blittingi@ t EXTTEXTOUTuDraw text (extra)i2 t DIBSTRETCHBLTuDIB stretch blittingiA t SETDIBTODEVuSet DIB to devicei3 t STRETCHDIBu Stretch DIBiCtTEXTtLOMETRICtHIMETRICt LOENGLISHt HIENGLISHtTWIPSt ISOTROPICt ANISOTROPICccstt|dÉtÉVdS(Nt mapping_mode(RRtEMF_MAPPING_MODE(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseEmfMappingModeŒsccs t|dÉVt|dÉVdS(NRR(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt parseXY32—sccstt|dÉtÉVdS(NR)(RRR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseObjectID32’sccs<t|dÉVt|dÉVt|dÉVt|dÉVdS(NtihBrushtstyleRthatch(RRR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseBrushIndirectÿstPoint16cBs eZdZdÑZdÑZRS(i ccs t|dÉVt|dÉVdS(NRR(R (R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR-‡scCsd|di|difS(NsPoint16: (%i,%i)RR(R.(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR/„s(R0R1R2R-R/(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyRáfis ccsLt|dÉVt|dÉVx)t|diÉD]}t|dÉVq0WdS(NtboundsR3spoint[](tRECT32RR4R.Rá(RR5((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparsePoint16arrayÊs ccs;t|dÉV|di}|ot|d|ÉVndS(Nt data_sizetdata(RR.R (Rtsize((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseGDICommentÏs ccst|dÉVdS(Nticm_mode(R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt parseICMModeÚsccs t|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVt|d ÉVt|d ÉVt|d ÉVx)t|d iÉD]}t|d ÉVqÆWdS( NtihPentoffBmitcbBmitoffBitstcbBitsRtwidthRRRÖtnb_styleRÑ(RRR4R.(RR5((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytparseExtCreatePenıstHEADERuHeadert POLYBEZIERuDraw poly bezieru Draw polygonu Draw polylinet POLYBEZIERTOuDraw poly bezier tot POLYLINETOuDraw poly line tot POLYPOLYLINEuDraw poly polylineuDraw poly polygontSETWINDOWEXTEXuSet window extend EXtSETWINDOWORGEXuSet window origin EXtSETVIEWPORTEXTEXuSet viewport extend EXtSETVIEWPORTORGEXuSet viewport origin EXt SETBRUSHORGEXuSet brush org EXt SETPIXELVu Set pixel ViiuSet polyfill modeiuSet ROP2iuSet stretching blitting modeiuSet text alignitSETCOLORADJUSTMENTuSet color adjustmentiiiuOffset clipping regionitMOVETOEXu Move to EXit SETMETARGNuSet meta regioniitSCALEVIEWPORTEXTEXuScale viewport extend EXitSCALEWINDOWEXTEXuScale window extend EXi i!i"tSETWORLDTRANSFORMuSet world transformi#tMODIFYWORLDTRANSFORMuModify world transformi$i%t CREATEPENu Create peni&i'i(tANGLEARCuDraw angle arci)u Draw ellipsei*uDraw rectanglei+uDraw rounded rectanglei,uDraw arci-u Draw chordi.uDraw piei/i0i1tSETPALETTEENTRIESt RESIZEPALETTEuResize palettei3i4uEXT flood fillu Draw line toi6tARCTOu Draw arc totPOLYDRAWuDraw poly drawi8tSETARCDIRECTIONuSet arc directioni9t SETMITERLIMITuSet miter limiti:t BEGINPATHu Begin pathi;tENDPATHuEnd pathi<t CLOSEFIGUREu Close figurei=tFILLPATHu Fill pathi>tSTROKEANDFILLPATHuStroke and fill pathi?t STROKEPATHu Stroke pathi@t FLATTENPATHu Flatten pathiAt WIDENPATHu Widen pathiBtSELECTCLIPPATHuSelect clipping pathiCt ABORTPATHu Arbort pathiDt GDICOMMENTu GDI commentiFtFILLRGNiGtFRAMERGNu Frame regioniHt INVERTRGNiItPAINTRGNiJtEXTSELECTCLIPRGNuEXT select clipping regioniKtBITBLTu Bit blittingiLt STRETCHBLTuStretch blittingiMtMASKBLTu Mask blittingiNtPLGBLTu PLG blittingiOtSETDIBITSTODEVICEuSet DIB bits to deviceiPt STRETCHDIBITSuStretch DIB bitsiQtEXTCREATEFONTINDIRECTWuEXT create font indirect WiRt EXTTEXTOUTAuEXT text out AiSt EXTTEXTOUTWuEXT text out WiTt POLYBEZIER16uDraw poly bezier (16-bit)iUt POLYGON16uDraw polygon (16-bit)iVt POLYLINE16uDraw polyline (16-bit)iWtPOLYBEZIERTO16uDraw poly bezier to (16-bit)iXt POLYLINETO16uDraw polyline to (16-bit)iYtPOLYPOLYLINE16uDraw poly polyline (16-bit)iZt POLYPOLYGON16uDraw poly polygon (16-bit)i[t POLYDRAW16uDraw poly draw (16-bit)i\tCREATEMONOBRUSHuCreate monobrushi]tCREATEDIBPATTERNBRUSHPTuCreate DIB pattern brush PTi^t EXTCREATEPENuEXT create peni_t POLYTEXTOUTAuPoly text out Ai`t POLYTEXTOUTWuPoly text out Wiat SETICMMODEu Set ICM modeibtCREATECOLORSPACEuCreate color spaceict SETCOLORSPACEuSet color spaceidtDELETECOLORSPACEuDelete color spaceiet GLSRECORDu GLS recordiftGLSBOUNDEDRECORDuGLS bound ED recordigt PIXELFORMATu Pixel formatihtFunctioncBs,eZdÑZdÑZdÑZdÑZRS(cGsPti||å|iiÉo|did|_n|did|_dS(NRçii(Rt__init__troottisEMFR.t_size(R,targs((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR·qsccs#|iiÉo^tt|dÉtÉVt|dÉVyt|did}Wq»tj o d}q»Xn[t|dÉVtt |dÉt ÉVyt |did}Wntj o d}nX|o xM||ÉD] }|Vq‹Wn1|i |i d}|ot|d|ÉVndS(NtfunctionRçiiRå(R‚R„RRt EMF_META_NAMEtEMF_METAR.tKeyErrortNoneRt META_NAMEtMETARçt current_sizeR (R,RtfieldRç((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR-xs(   cCs|d}|i|iÉjS(NRÊ(R.tgetEnum(R,tfunc((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytisValidès cCsY|iiÉot|diSyt|diSWntj od|diSXdS(NRÊs Function %s(R‚R„t EMF_META_DESCR.t META_DESCRÈtdisplay(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR/ìs (R0R1R·R-RÒR/(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR‡ps   tRECT16cBs;eZedfedfedfedffZdÑZRS(tleftttoptrighttbottomcCsOd|ii|di|di|di|di|di|difS(Ns%s: %ux%u at (%u,%u)R¯RˆR˘R˜(t __class__R0R.(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR/¢s   (R0R1R tformatR/(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyRıõs    RâcBs2eZedfedfedfedffZRS(RˆR˜R¯R˘(R0R1RR˚(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyRâ™s   tPlaceableHeadercBseZdZdZdÑZRS(s^ Header of Placeable Metafile (file extension .APM), created by Aldus Corporation s◊Õ∆öccsptt|ddÉtÉVt|dÉVt|dÉVt|dÉVt|ddÉVtt|dÉtÉVdS( Nt signatures*Placeable Metafiles signature (0x9AC6CDD7)thandletrecttinchtreserveditchecksum(RRRRRıR (R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR-πs (R0R1t__doc__tMAGICR-(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR¸≤st EMF_HeadercBs eZdZdÑZdÑZRS(s EMFcGs(ti||å|did|_dS(NRçi(RR·R.R‰(R,RÂ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR·√sccs‡t}t|ddÉVt|ddÉVt|ddÉVt|ddÉVtt|d d ÉtÉVt|d d ÉVt|d dÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉV||ddÉV||dd ÉV||d!d"ÉV||d#d$ÉV|di}|i|i d%}|did}||jo(|o!t |d&|d'd(d)d*ÉVn|di|i d%}|ot |d+|ÉVndS(,NttypesRecord type (always 1)RçsSize of the header in bytestBoundssInclusive boundstFramesInclusive picture frameR˝s Signature ID (always 0x464D4520)tmin_vers Minor versiontmaj_vers Major versiont file_sizesSize of the file in bytest NumOfRecordss!Number of records in the metafilet NumOfHandless%Number of handles in the handle tableRit desc_sizes#Size of description in 16-bit wordst desc_ofsts(Offset of description string in metafilet nb_colorssNumber of color palette entriestwidth_pxs#Width of reference device in pixelst height_pxs$Height of reference device in pixelstwidth_mms(Width of reference device in millimeterst height_mms)Height of reference device in millimetersit descriptiontcharsets UTF-16-LEtstript tpadding( RRRâRRRR R.tabsolute_addressRÌR R (R,tLONGtoffsettcurrentRç((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR-«s6 !(R0R1RR·R-(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR¡s tWMF_FilecBs∂eZhdd6dd6d"d6d#d6eidfeid$fd%d&fd6d'd6dd6ZeZhdd6dd6ZdÑZ dÑZ dÑZ dÑZ dÑZ d ÑZd!ÑZRS((twmftidtimagetcategorytapmtemftfile_extu image/wmfu image/x-wmfuimage/x-win-metafileuapplication/x-msmetafileuapplication/wmfuapplication/x-wmfu image/x-emftmimeii(it s tmagictmin_sizeu Microsoft Windows Metafile (WMF)RtmemorytdiskicCsé|iÉo_|d}|didjodS|didjodS|did jod St}nü|iÉo@|d }|d id jodS|didjod Sn|didjodS|didjodS|did jodSt}x}tdÉD]o}y|d|}Wn>tj o|iotSd|St j o d|SX|i Ép d|SqWtS(Nt emf_headerR˝i EMFsInvalid signatureRisInvalid record typeRtsInvalid reservedt amf_headerR˛isInvalid handlett file_typesInvalid file typet header_sizei sInvalid header sizet nb_paramssInvalid number of parametersisfunc[%u]sUnable to get function #%usUnable to create function #%usFunction #%u is invalid(ii( R„R.RÁtisAPMRÎR4RtdonetTrueRRÒ(R,R$t FUNC_DICTtamfR5R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytvalidateˇsF            ccsÛ|iÉot|dÉVn±|iÉot|dÉVntt|dÉ|iÉVt|ddÉVt|ddÉVt|dd ÉVt|d d ÉVt|d d ÉVt|ddÉVt|ddÉVx|i pt |dÉVq“WdS(NR,R.R0R1s)Size of header in 16-bit words (always 9)t win_ver_mins"Minor version of Microsoft Windowst win_ver_majs"Major version of Microsoft WindowsR s*Total size of the metafile in 16-bit wordstnb_objsNumber of objects in the filetmax_record_sizes*The size of largest record in 16-bit wordsR2sNot Used (always 0)sfunc[]( R„RR3R¸RRt FILE_TYPER RteofR‡(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR-,s   cCs_d|ijo|didjS|idjotSti}|iidt|ÉÉ|jS( sFile is in EMF format?iiR,i,ii(i`i@( tcurrent_lengthtnameRçtFalseRRtstreamt readBytestlen(R,R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR„>s  cCsNd|ijo|didjSti}|iidt|ÉÉ|jSdS(s,File is in Aldus Placeable Metafiles format?iiR.N(R?R@R¸RRBRCRD(R,R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR3Gs cCs,|iÉodS|iÉodSdSdS(Nu)Microsoft Enhanced Metafile (EMF) pictureu&Aldus Placeable Metafile (APM) pictureu(Microsoft Windows Metafile (WMF) picture(R„R3(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyR/Os   cCs|iÉodSdSdS(Nu image/x-emfu image/wmf(R„(R,((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytcreateMimeTypeWs cCsU|iÉodS|di}|iid|tdÉ}|dj o |dSdS(Nsfunc[0]siii0(R„RÍRRBt searchBytest MAX_FILESIZE(R,tstarttend((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pytcreateContentSize]s    (RR#semf(u image/wmfu image/x-wmfuimage/x-win-metafileuapplication/x-msmetafileuapplication/wmfuapplication/x-wmfu image/x-emfi@(R'i(s ii@(R0R1R¸RRt PARSER_TAGSRtendianR=R8R-R„R3R/RERJ(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyRËs,     -    Ni»i (R7u End of fileN(R8uSave device contextN(R9uRealize paletteN(R:uSet palette entriesN(R;uCreate paletteN(R<uSet background modeN(R=uSet mapping modeN(R@uSet bitmap streching modeN(RAuSet text character extraN(RBuRestore device contextN(RCu Invert regionN(RDu Paint regionN(REuSelect clipping regionN(RGuSet text alignmentN(RHu'Create DIB brush with specified patternN(RJuSet background colorN(RKuSet text colorN(RLuSet text justificationN(ROuSet view port originN(RPuSet view port extendsN(RQuOffset window originN(RRuOffset view port originN(RSuDraw a line toN(RTuMove toN(RUuOffset clipping rectangleN(RVu Fill regionN(RWuSet mapper flagsN(RXuSelect paletteN(RYuCreate font indirectN(R]uDraw a polylineN(R^uScale window extendsN(R_uScale view port extendsN(R`uExclude clipping rectangleN(RauIntersect clipping rectangleN(RbuDraw an ellipseN(Rcu Flood fillN(RduDraw a rectangleN(Reu Set pixelN(Rfu Fram regionN(Rgu Draw textN(RhuDraw multiple polygonsN(RiuExtend flood fillN(RjuDraw a rounded rectangleN(RkuPattern blittingN(RluEscapeN(Rmu Create regionN(Rnu Draw an arcN(Rou Draw a pieN(Rpu Draw a chordN(RquDIB bit blittingN(RruDraw text (extra)N(RsuDIB stretch blittingN(RtuSet DIB to deviceN(Ruu Stretch DIBN(sHEADERuHeaderN(RöuDraw poly bezierN(R\u Draw polygonN(R]u Draw polylineN(RõuDraw poly bezier toN(RúuDraw poly line toN(RùuDraw poly polylineN(RhuDraw poly polygonN(R¢uSet brush org EXN(R7u End of fileN(R£u Set pixel VN(RWuSet mapper flagsN(R<uSet background modeN(R?uSet polyfill modeN(R>uSet ROP2N(R@uSet stretching blitting modeN(RGuSet text alignN(R§uSet color adjustmentN(RKuSet text colorN(RJuSet background colorN(RUuOffset clipping regionN(R¶uSet meta regionN(R`uExclude clipping rectangleN(RauIntersect clipping rectangleN(RßuScale viewport extend EXN(R®uScale window extend EXN(R8uSave device contextN(RBuRestore device contextN(R©uSet world transformN(R™uModify world transformN(R´u Create penN(R¨uDraw angle arcN(Rbu Draw ellipseN(RduDraw rectangleN(RjuDraw rounded rectangleN(RnuDraw arcN(Rpu Draw chordN(RouDraw pieN(RXuSelect paletteN(R;uCreate paletteN(R≠uSet palette entriesN(RÆuResize paletteN(R9uRealize paletteN(RiuEXT flood fillN(RØu Draw arc toN(R∞uDraw poly drawN(R±uSet arc directionN(R≤uSet miter limitN(R≥u Begin pathN(R¥uEnd pathN(Rµu Close figureN(R∂u Fill pathN(R∑uStroke and fill pathN(R∏u Stroke pathN(Rπu Flatten pathN(R∫u Widen pathN(RªuSelect clipping pathN(Rºu Arbort pathN(Ræu Fill regionN(Røu Frame regionN(R¿u Invert regionN(R¡u Paint regionN(R¬uEXT select clipping regionN(R√u Bit blittingN(RƒuStretch blittingN(R≈u Mask blittingN(R∆u PLG blittingN(R«uSet DIB bits to deviceN(R»uStretch DIB bitsN(R…uEXT create font indirect WN(R uEXT text out AN(RÀuEXT text out WN(RÃuDraw poly bezier (16-bit)N(R—uDraw poly polyline (16-bit)N(R”uDraw poly draw (16-bit)N(R‘uCreate monobrushN(R’uCreate DIB pattern brush PTN(R◊uPoly text out AN(RÿuPoly text out WN(R⁄uCreate color spaceN(R€uSet color spaceN(R‹uDelete color spaceN(R›u GLS recordN(RfiuGLS bound ED recordN(Rflu Pixel formatN(?RRGthachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R thachoir_core.endianRthachoir_core.text_handlerRRthachoir_core.toolsRthachoir_parser.image.commonRR%RRR"R'RRR#R&R(R*R+R6RÍRÏRÎRÛRRÄRÅRÇRÜRáRäRéRêRòRËRÁRÚR‡RıRâR¸RR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/wmf.pyt<module>sX                      +'
30,906
Python
.py
100
307.73
1,943
0.523551
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,649
tga.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/tga.pyc
—Ú Œ »Mc@s§dZddklZddklZlZlZlZlZddk l Z ddk l Z defdÑÉYZ defd ÑÉYZd efd ÑÉYZd S( sc Truevision Targa Graphic (TGA) picture parser. Author: Victor Stinner Creation: 18 december 2006 iˇˇˇˇ(tParser(tFieldSettUInt8tUInt16tEnumtRawBytes(t LITTLE_ENDIAN(t PaletteRGBtLinecBseZdÑZdÑZRS(cGs/ti||å|di|di|_dS(Ns/widths/bpp(Rt__init__tvaluet_size(tselftargs((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyR sccs0x)t|diÉD]}t|dÉVqWdS(Ns/widthspixel[](txrangeR R(R tx((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyt createFieldss(t__name__t __module__R R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyR s tPixelscBseZdÑZdÑZRS(cGs:ti||å|di|di|di|_dS(Ns/widths/heights/bpp(RR R R (R R ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyR sccso|didjo!t|didddÉ}nt|diÉ}x |D]}t|d|ÉVqOWdS(Ns/optionsis/heightiiˇˇˇˇsline[%u](R RR(R tRANGEty((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyRs !(RRR R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyRs t TargaFilecBsreZhdd6dd6dd6dd 6dd 6d d6Zhdd6dd6dd6dd6ZeZdÑZdÑZRS(ttargatidtimagetcategoryttgatfile_extu image/targau image/tgau image/x-tgatmimeiitmin_sizeuTruevision Targa Graphic (TGA)t descriptionu8-bit uncompressediu24-bit uncompressediu 8-bit RLEi u 24-bit RLEi cCs|didjodS|di|ijodS|didjp|didjod S|d idjod StS(NtversionisUnknown versiontcodecs Unknown codectx_minity_mins(x_min, y_min) is not (0,0)tbppiisUnknown bits/pixel value(ii(R t CODEC_NAMEtTrue(R ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pytvalidate4s(ccsOt|ddÉVt|ddÉVtt|ddÉ|iÉVt|ddÉVt|d d ÉVt|d d ÉVt|d ÉVt|dÉVt|dÉVt|dÉVt|ddÉVt|ddÉV|didjot|ddÉVn|didjot|dÉVn1|i|id}|ot |d|ÉVndS(Nthdr_sizesHeader size in bytesR sTarga version (always one)R!sPixels encodingt palette_ofssPalette absolute file offsettnb_colorsNumber of colortcolor_map_sizesColor map entry sizeR"R#twidththeightR$sBits per pixeltoptionssOptions (0: vertical mirror)itpaletteiitpixelst raw_pixels( RRR%RR RRtsizet current_sizeR(R R2((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyR?s&(R(u image/targau image/tgau image/x-tgaiê(RRt PARSER_TAGSR%RtendianR'R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyR#s   N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRthachoir_core.endianRthachoir_parser.image.commonRRRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/tga.pyt<module>s( 
4,402
Python
.py
25
175
697
0.460818
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,650
png.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/png.py
""" PNG picture file parser. Documents: - RFC 2083 http://www.faqs.org/rfcs/rfc2083.html Author: Victor Stinner """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Fragment, ParserError, MissingField, UInt8, UInt16, UInt32, String, CString, Bytes, RawBytes, Bit, NullBits, Enum, CompressedField) from hachoir_parser.image.common import RGB from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.endian import NETWORK_ENDIAN from hachoir_core.tools import humanFilesize from datetime import datetime MAX_FILESIZE = 500 * 1024 * 1024 try: from zlib import decompressobj class Gunzip: def __init__(self, stream): self.gzip = decompressobj() def __call__(self, size, data=None): if data is None: data = self.gzip.unconsumed_tail return self.gzip.decompress(data, size) has_deflate = True except ImportError: has_deflate = False UNIT_NAME = {1: "Meter"} COMPRESSION_NAME = { 0: u"deflate" # with 32K sliding window } MAX_CHUNK_SIZE = 500 * 1024 # Maximum chunk size (500 KB) def headerParse(parent): yield UInt32(parent, "width", "Width (pixels)") yield UInt32(parent, "height", "Height (pixels)") yield UInt8(parent, "bit_depth", "Bit depth") yield NullBits(parent, "reserved", 5) yield Bit(parent, "has_alpha", "Has alpha channel?") yield Bit(parent, "color", "Color used?") yield Bit(parent, "has_palette", "Has a color palette?") yield Enum(UInt8(parent, "compression", "Compression method"), COMPRESSION_NAME) yield UInt8(parent, "filter", "Filter method") yield UInt8(parent, "interlace", "Interlace method") def headerDescription(parent): return "Header: %ux%u pixels and %u bits/pixel" % \ (parent["width"].value, parent["height"].value, getBitsPerPixel(parent)) def paletteParse(parent): size = parent["size"].value if (size % 3) != 0: raise ParserError("Palette have invalid size (%s), should be 3*n!" % size) nb_colors = size // 3 for index in xrange(nb_colors): yield RGB(parent, "color[]") def paletteDescription(parent): return "Palette: %u colors" % (parent["size"].value // 3) def gammaParse(parent): yield UInt32(parent, "gamma", "Gamma (x10,000)") def gammaValue(parent): return float(parent["gamma"].value) / 10000 def gammaDescription(parent): return "Gamma: %.3f" % parent.value def textParse(parent): yield CString(parent, "keyword", "Keyword", charset="ISO-8859-1") length = parent["size"].value - parent["keyword"].size/8 if length: yield String(parent, "text", length, "Text", charset="ISO-8859-1") def textDescription(parent): if "text" in parent: return u'Text: %s' % parent["text"].display else: return u'Text' def timestampParse(parent): yield UInt16(parent, "year", "Year") yield UInt8(parent, "month", "Month") yield UInt8(parent, "day", "Day") yield UInt8(parent, "hour", "Hour") yield UInt8(parent, "minute", "Minute") yield UInt8(parent, "second", "Second") def timestampValue(parent): value = datetime( parent["year"].value, parent["month"].value, parent["day"].value, parent["hour"].value, parent["minute"].value, parent["second"].value) return value def physicalParse(parent): yield UInt32(parent, "pixel_per_unit_x", "Pixel per unit, X axis") yield UInt32(parent, "pixel_per_unit_y", "Pixel per unit, Y axis") yield Enum(UInt8(parent, "unit", "Unit type"), UNIT_NAME) def physicalDescription(parent): x = parent["pixel_per_unit_x"].value y = parent["pixel_per_unit_y"].value desc = "Physical: %ux%u pixels" % (x,y) if parent["unit"].value == 1: desc += " per meter" return desc def parseBackgroundColor(parent): yield UInt16(parent, "red") yield UInt16(parent, "green") yield UInt16(parent, "blue") def backgroundColorDesc(parent): rgb = parent["red"].value, parent["green"].value, parent["blue"].value name = RGB.color_name.get(rgb) if not name: name = "#%02X%02X%02X" % rgb return "Background color: %s" % name class ImageData(Fragment): def __init__(self, parent, name="compressed_data"): Fragment.__init__(self, parent, name, None, 8*parent["size"].value) data = parent.name.split('[') data, next = "../%s[%%u]" % data[0], int(data[1][:-1]) + 1 first = parent.getField(data % 0) if first is parent: first = None if has_deflate: CompressedField(self, Gunzip) else: first = first[name] try: _next = parent[data % next] next = lambda: _next[name] except MissingField: next = None self.setLinks(first, next) def parseTransparency(parent): yield UInt8(parent, "color_index") def textTransparency(parent): return "Transparency: color #%u" % parent["color_index"].value def getBitsPerPixel(header): nr_component = 1 if header["has_alpha"].value: nr_component += 1 if header["color"].value and not header["has_palette"].value: nr_component += 2 return nr_component * header["bit_depth"].value class Chunk(FieldSet): TAG_INFO = { "tIME": ("time", timestampParse, "Timestamp", timestampValue), "pHYs": ("physical", physicalParse, physicalDescription, None), "IHDR": ("header", headerParse, headerDescription, None), "PLTE": ("palette", paletteParse, paletteDescription, None), "gAMA": ("gamma", gammaParse, gammaDescription, gammaValue), "tEXt": ("text[]", textParse, textDescription, None), "tRNS": ("transparency", parseTransparency, textTransparency, None), "bKGD": ("background", parseBackgroundColor, backgroundColorDesc, None), "IDAT": ("data[]", lambda parent: (ImageData(parent),), "Image data", None), "iTXt": ("utf8_text[]", None, "International text (encoded in UTF-8)", None), "zTXt": ("comp_text[]", None, "Compressed text", None), "IEND": ("end", None, "End", None) } def createValueFunc(self): return self.value_func(self) def __init__(self, parent, name, description=None): FieldSet.__init__(self, parent, name, description) self._size = (self["size"].value + 3*4) * 8 if MAX_CHUNK_SIZE < (self._size//8): raise ParserError("PNG: Chunk is too big (%s)" % humanFilesize(self._size//8)) tag = self["tag"].value self.desc_func = None self.value_func = None if tag in self.TAG_INFO: self._name, self.parse_func, desc, value_func = self.TAG_INFO[tag] if value_func: self.value_func = value_func self.createValue = self.createValueFunc if desc: if isinstance(desc, str): self._description = desc else: self.desc_func = desc else: self._description = "" self.parse_func = None def createFields(self): yield UInt32(self, "size", "Size") yield String(self, "tag", 4, "Tag", charset="ASCII") size = self["size"].value if size != 0: if self.parse_func: for field in self.parse_func(self): yield field else: yield RawBytes(self, "content", size, "Data") yield textHandler(UInt32(self, "crc32", "CRC32"), hexadecimal) def createDescription(self): if self.desc_func: return self.desc_func(self) else: return "Chunk: %s" % self["tag"].display class PngFile(Parser): PARSER_TAGS = { "id": "png", "category": "image", "file_ext": ("png",), "mime": (u"image/png", u"image/x-png"), "min_size": 8*8, # just the identifier "magic": [('\x89PNG\r\n\x1A\n', 0)], "description": "Portable Network Graphics (PNG) picture" } endian = NETWORK_ENDIAN def validate(self): if self["id"].value != '\x89PNG\r\n\x1A\n': return "Invalid signature" if self[1].name != "header": return "First chunk is not header" return True def createFields(self): yield Bytes(self, "id", 8, r"PNG identifier ('\x89PNG\r\n\x1A\n')") while not self.eof: yield Chunk(self, "chunk[]") def createDescription(self): header = self["header"] desc = "PNG picture: %ux%ux%u" % ( header["width"].value, header["height"].value, getBitsPerPixel(header)) if header["has_alpha"].value: desc += " (alpha layer)" return desc def createContentSize(self): field = self["header"] start = field.absolute_address + field.size end = MAX_FILESIZE * 8 pos = self.stream.searchBytes("\0\0\0\0IEND\xae\x42\x60\x82", start, end) if pos is not None: return pos + 12*8 return None
9,139
Python
.py
230
32.465217
85
0.617883
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,651
__init__.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/__init__.pyc
Ñò Î ÈMc @s´ddklZddklZddklZddklZddkl Z ddk l Z ddk l Z ddklZdd klZdd klZdd klZd S( iÿÿÿÿ(tBmpFile(tGifFile(tIcoFile(tJpegFile(tPcxFile(tPsdFile(tPngFile(t TargaFile(tTiffFile(tWMF_File(tXcfFileN(thachoir_parser.image.bmpRthachoir_parser.image.gifRthachoir_parser.image.icoRthachoir_parser.image.jpegRthachoir_parser.image.pcxRthachoir_parser.image.psdRthachoir_parser.image.pngRthachoir_parser.image.tgaRthachoir_parser.image.tiffRthachoir_parser.image.wmfR thachoir_parser.image.xcfR (((sG/pentest/enumeration/google/metagoofil/hachoir_parser/image/__init__.pyt<module>s
927
Python
.py
5
184.4
611
0.52546
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,652
tiff.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/tiff.pyc
—Ú Œ »Mc@sdZddklZddklZlZlZlZlZl Z l Z l Z ddk l Z lZddklZddklZdZdefd ÑÉYZd efd ÑÉYZd efd ÑÉYZdefdÑÉYZdeefdÑÉYZdS(sb TIFF image parser. Authors: Victor Stinner and Sebastien Ponce Creation date: 30 september 2006 iˇˇˇˇ(tParser(tFieldSettSeekableFieldSett ParserErrortRootSeekableFieldSettUInt16tUInt32tBytestString(t LITTLE_ENDIANt BIG_ENDIAN(t BasicIFDEntry(t createDicti˙tIFDEntrycBs9eZdÂZhKdÊd6dÁd6dËd 6dÈd 6dÍd6dÎd6dÏd6dÌd6dÓd6dÔd6dd"6dÒd%6dÚd(6dÛd+6dÙd.6dıd16dˆd46d˜d76d¯d:6d˘d=6d˙d@6d˚dC6d¸dF6d˝dI6d˛dL6dˇdO6ddR6ddU6ddX6dd[6dd^6dda6ddd6ddg6ddj6d dm6d dp6d ds6d dv6d dy6dd|6dd6ddÇ6ddÖ6ddà6ddã6ddé6ddë6ddî6ddó6ddö6ddù6dd†6dd£6dd¶6dd©6dd¨6ddØ6d d≤6d!dµ6d"d∏6d#dª6d$dæ6d%d¡6d&dƒ6d'd«6d(d 6d)dÕ6d*d–6d+d”6d,d÷6d-dŸ6d.d‹6d/dfl6d0d‚6Zeed„ÉZd‰ÑZRS(1i itnew_subfile_typesNew subfile typei˛t subfile_types Subfile typeiˇt img_widthsImage width in pixelsit img_heightsImage height in pixelsitbits_per_samplesBits per sampleit compressionsCompression methoditphoto_interpretsPhotometric interpretationitthrest Thresholdingit cell_widths Cellule widthit cell_heightsCellule heighti t fill_orders Fill orderi tdoc_names Document namei t descriptionsImage descriptionitmaketMakeitmodeltModelit strip_ofss Strip offsetsit orientationt Orientationit sample_pixelsSamples per pixelit row_per_stripsRows per stripit strip_bytesStrip byte countsitmin_sample_valuesMin sample valueitmax_sample_valuesMax sample valueitxress X resolutionityress Y resolutionit planar_confsPlanar configurationit page_names Page nameitxposs X positionityposs Y positionitfree_ofss Free offsetsi t free_bytesFree byte countsi!tgray_resp_unitsGray response uniti"tgray_resp_curvesGray response curvei#t group3_optsGroup 3 optionsi$t group4_optsGroup 4 optionsi%tres_unitsResolution uniti(tpage_nbs Page numberi)tcolor_respt_curvesColor response curvesi-tsoftwaretSoftwarei1t date_times Date timei2tartisttArtisti;t host_computers Host computeri<t predicatort Predicatori=twhite_pts White pointi>t prim_chomatsPrimary chromaticitiesi?t color_maps Color mapi@thalf_tone_hintssHalftone HintsiAt tile_widtht TileWidthiBt tile_lengtht TileLengthiCt tile_offsetst TileOffsetsiDttile_byte_countstTileByteCountsiEtink_settInkSetiLt ink_namestInkNamesiMtnumber_of_inkst NumberOfInksiNt dot_rangetDotRangeiPttarget_printert TargetPrinteriQt extra_samplest ExtraSamplesiRt sample_formatt SampleFormatiStsmin_sample_valuetSMinSampleValueiTtsmax_sample_valuetSMaxSampleValueiUttransfer_ranget TransferRangeiVt jpeg_proctJPEGProcitjpeg_interchange_formattJPEGInterchangeFormatitjpeg_interchange_format_lengthtJPEGInterchangeFormatLengthitjpeg_restart_intervaltJPEGRestartIntervalitjpeg_lossless_predictorstJPEGLosslessPredictorsitjpeg_point_transformstJPEGPointTransformsit jpeg_qtablest JPEGQTablesit jpeg_dctablest JPEGDCTablesit jpeg_actablest JPEGACTablesi tycbcr_coefficientstYCbCrCoefficientsitycbcr_subsamplingtYCbCrSubSamplingitycbcr_positioningtYCbCrPositioningitreference_blackwhitetReferenceBlackWhiteit copyrightt CopyrightiòÇt ifd_pointersPointer to next IFD entryiiáicGsWti||å|di}||ijo|i|\|_|_n d|_dS(Nttag(Rt__init__tvaluetTAG_INFOt_namet _descriptiontNonet_parser(tselftargsR|((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR}cs  i`(RsNew subfile type(Rs Subfile type(RsImage width in pixels(RsImage height in pixels(sbits_per_samplesBits per sample(s compressionsCompression method(RsPhotometric interpretation(RR(s cell_widths Cellule width(s cell_heightsCellule height(Rs Fill order(Rs Document name(s descriptionsImage description(RR(RR(R s Strip offsets(R!R"(R#sSamples per pixel(R$sRows per strip(R%sStrip byte counts(R&sMin sample value(R'sMax sample value(sxress X resolution(syress Y resolution(R*sPlanar configuration(R+s Page name(R,s X position(R-s Y position(R.s Free offsets(R/sFree byte counts(R0sGray response unit(R1sGray response curve(R2sGroup 3 options(R3sGroup 4 options(R4sResolution unit(R5s Page number(R6sColor response curves(ssoftwaresSoftware(R9s Date time(sartistsArtist(R<s Host computer(R=R>(R?s White point(R@sPrimary chromaticities(s color_maps Color map(RBsHalftone Hints(RCRD(RERF(RGRH(RIRJ(RKRL(RMRN(RORP(RQRR(RSRT(RURV(RWRX(RYRZ(R[R\(R]R^(R_R`(RaRb(RcRd(ReRf(RgRh(RiRj(RkRl(RmRn(RoRp(RqRr(RsRt(RuRv(RwRx(s copyrights Copyright(R{sPointer to next IFD entry(t__name__t __module__t static_sizeRR tTAG_NAMER}(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR sû tIFDcBseZdÑZdÑZRS(cGs8ti||åd|diti|_t|_dS(Nitcount(RR}R~R Ràt_sizetFalset _has_offset(RÑRÖ((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR}lsccsmt|dÉVt|dijotd|diÉÇnx)t|diÉD]}t|dÉVqQWdS(NRãsTIFF IFD: Invalid count (%s)sentry[](Rt MAX_COUNTR~RtxrangeR (RÑtindex((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyt createFieldsqs(RÜRáR}Rí(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyRäks t ImageFilecBseZdÑZdÑZRS(cCs/ti||||dÉt|_||_dS(N(RR}RÇRçRét_ifd(RÑtparenttnameRtifd((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR}zs c csèh}xÛ|iD]Ë}t|Étjoqnx≈|D]Ω}|idjoq7n|i|itÉd|if}ti|di}|di}|t jo!t ||i||ddÉVn.t ||i|||É}|||i<|VPq7WqWd|joÇd|jouxrt |di ÉD]Y}|i|dd t |Éd itÉt|d |dd t |Éd iÉVq*WndS( Ntoffsetsdata of ifd entry ttypeRãts ISO-8859-1R R%svalue[t]sstrip[](RîRôR RñtseekByteR~RçR t ENTRY_FORMATRtDataRêt_counttstrR( RÑtdatastentrytctdesct entryTypeRãtdti((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyRís0   !  )(RÜRáR}Rí(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyRìys RûcBseZdÑZdÑZRS(cCs<|i|}ti|||||É||_||_dS(N(RàRR}Rüt_type(RÑRïRñR§RôRãtsize((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR}ös  ccs/x(t|iÉD]}|i|dÉVqWdS(Nsvalue[](RêRüR®(RÑRß((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyRí†s(RÜRáR}Rí(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyRûòs tTiffFilecBsfeZhdd6dd6dd6dd6dd 6ddfd 6dd6ZeZdÑZdÑZdÑZRS(ttifftidtimagetcategoryttiftfile_extu image/tifftmimeitmin_sizesII*itMM*tmagics TIFF pictureRcKseti|dd|d|i|ÉÉ|iiddÉdjo t|_nti|||çdS(NtrootiitMM( RR}RÇtaskSizetstreamt readBytesR tendianR(RÑR∏RÖ((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR}≥s% cCsH|iiddÉ}|d jo d|S|didjodStS( NiiR∂tIIsInvalid endian (%r)tversioni*sUnknown TIFF version(sMMsII(R∏RπR~tTrue(RÑR∫((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pytvalidateπs   ccsÔt|dddddÉVt|ddÉVt|dd É}|Vg}xutom|id joPn|i|id tÉt|d d dÉ}|i |É|Vt|dd É}|VqKWx(|D] }t |dd|É}|Vq«WdS(NR∫isEndian ("II" or "MM")tcharsettASCIIRºsTIFF version numbers img_dir_ofs[]s9Next image directory offset (in bytes from the beginning)itrelativesifd[]sImage File Directorysimage[]s Image File( RRRRΩR~RúRçRäRÇtappendRì(RÑRòtifdsRóR≠((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyRí¡s&  (RØR´(u image/tiffi@(sII*i(R≥i(RÜRát PARSER_TAGSR R∫R}RæRí(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyR™§s    N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRthachoir_core.endianR R thachoir_parser.image.exifR thachoir_core.toolsR RèR RäRìRûR™(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/tiff.pyt<module>s:Z
12,114
Python
.py
51
236.490196
1,326
0.499047
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,653
psd.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/psd.py
""" Photoshop parser (.psd file). Creation date: 8 january 2006 Author: Victor Stinner """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt16, UInt32, String, NullBytes, Enum, RawBytes) from hachoir_core.endian import BIG_ENDIAN from hachoir_parser.image.photoshop_metadata import Photoshop8BIM class Config(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) self._size = (4 + self["size"].value) * 8 def createFields(self): yield UInt32(self, "size") while not self.eof: yield Photoshop8BIM(self, "item[]") class PsdFile(Parser): endian = BIG_ENDIAN PARSER_TAGS = { "id": "psd", "category": "image", "file_ext": ("psd",), "mime": (u"image/psd", u"image/photoshop", u"image/x-photoshop"), "min_size": 4*8, "magic": (("8BPS\0\1",0),), "description": "Photoshop (PSD) picture", } COLOR_MODE = { 0: u"Bitmap", 1: u"Grayscale", 2: u"Indexed", 3: u"RGB color", 4: u"CMYK color", 7: u"Multichannel", 8: u"Duotone", 9: u"Lab Color", } COMPRESSION_NAME = { 0: "Raw data", 1: "RLE", } def validate(self): if self.stream.readBytes(0, 4) != "8BPS": return "Invalid signature" return True def createFields(self): yield String(self, "signature", 4, "PSD signature (8BPS)", charset="ASCII") yield UInt16(self, "version") yield NullBytes(self, "reserved[]", 6) yield UInt16(self, "nb_channels") yield UInt32(self, "width") yield UInt32(self, "height") yield UInt16(self, "depth") yield Enum(UInt16(self, "color_mode"), self.COLOR_MODE) # Mode data yield UInt32(self, "mode_data_size") size = self["mode_data_size"].value if size: yield RawBytes(self, "mode_data", size) # Resources yield Config(self, "config") # Reserved yield UInt32(self, "reserved_data_size") size = self["reserved_data_size"].value if size: yield RawBytes(self, "reserved_data", size) yield Enum(UInt16(self, "compression"), self.COMPRESSION_NAME) size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "end", size)
2,414
Python
.py
72
25.958333
83
0.5848
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,654
jpeg.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/jpeg.pyc
Ñò Î ÈMcm@sødZddklZddklZddklZlZlZl Z l Z l Z l Z l Z lZlZlZddklZddklZddklZlZddklZdd klZd½Zd¾Zd¿ZdÀZdÁZ dÂZ!d£efd¤„ƒYZ"d¥efd¦„ƒYZ#d§efd¨„ƒYZ$d©efdª„ƒYZ%d«efd¬„ƒYZ&d­efd®„ƒYZ'd¯efd°„ƒYZ(d±efd²„ƒYZ)d³efd´„ƒYZ*dµefd¶„ƒYZ+d·efd¸„ƒYZ,d¹efdº„ƒYZ-d»S(ÃsY JPEG picture parser. Information: - APP14 documents http://partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color - APP12: http://search.cpan.org/~exiftool/Image-ExifTool/lib/Image/ExifTool/TagNames.pod Author: Victor Stinner iÿÿÿÿ(t HachoirError(tParser( tFieldSett ParserErrortUInt8tUInt16tEnumtBittBitstNullBitst NullBytestStringtRawBytes(t PaletteRGB(t BIG_ENDIAN(t textHandlert hexadecimal(tExif(tPhotoshopMetadataidiiüi÷i¤iPi ißi¾i§i”i…ixioiei_iXiRiMiIiEi;i+iiiiîiÚiÉi·i¨iši�i‚iuili_iUiNiDi=i5i+i&iiii iiiûi÷ióiíièiãiÞiÙiÕiÏiÊiÆiÀi¼i·i±i­i¨i£i�i™i”i�i‹i„i€i}iwisilihici^iZiTiOiJiFi@i;i7i1i-i(i"iiiii iiii€i{i ~i{iÉwiltiÚqi·oiÈmiliYjiehibfitdi˜biÕ`i5_iŠ]i\i>Yi)UijQiíMi±JiÒGióDifBiÝ?i¸=i�;i¿9iñ7i#6iß4i3iž1i‡0i/i.iù,i+iË*i´)i˜(ià'iÈ&i&i\%i™$ié#i9#iv"i¿!i !iN i”iØiigi³iôiAi„iÏii\i¦iëi4iwi¹iiQi�iiZi˜iái0iriµ iþ iC i� i× i ie i¨iõi6i‚iËiiUiŸi*iwiÉiþiùi¦i|iciRiFi>i7i1i,i)i%i#i iiiiiiiiiéiáiÚiÓiÍiÁiºiµi¬i¤ižiœi˜i‘iŽiˆi…iƒi�i~i{ixiviqinikiiifiai\iYiWiSiQiLiDiBi?i=i9i4i2i0i,i*i'i%iiiiiiii iiiiÀ?i»?iJ>i­;i?9iù6i75i®3i;2i1iÐ/iU.iÀ,iI+iÚ)ix(i+'iÏ%i˜$i`#iè!i‹ i;iôiÐi¬i§i¢iÉiíi3i|iÃi-ixiÞipiÝioiioi)i¸iFiüiŒiEiûi«ihi%iÕ i‹ iD iû i¯ ib i iÍ iˆ i: iô i§ ia i iÍ i… i: iòi£iXiiÌi{iBiíiœiTiiÅivi.iãi›iiÁiti.iài›iPii¹iqi$iÝi—iVii i ii ii ii!i)iiiii#i8i+i$iii3i:i&i.i5i<i6i/i>t JpegChunkApp0cBs,eZhdd6dd6dd6Zd„ZRS(tpixelsis dots per inchis dots per cmiccsMt|dddddƒV|didjotdƒ‚nt|dd ƒVt|d d ƒVtt|d d ƒ|iƒV|d idjo&t|ddƒVt|ddƒVn#t|ddƒVt|ddƒVt|ddƒVt|ddƒV|di|di}|djo)t|ddƒVt|d|dƒVndS(Ntjfifis JFIF stringtcharsettASCIItJFIFs:Stream doesn't look like JPEG chunk (wrong JFIF signature)tver_majs Major versiontver_mins Minor versiontunitstUnitsitaspect_xsAspect ratio (X)taspect_ysAspect ratio (Y)t x_densitys X densityt y_densitys Y densitytthumb_wsThumbnail widthtthumb_hsThumbnail heightt thumb_paletteit thumb_datasThumbnail data( R tvalueRRRt UNIT_NAMERR R (tselft thumb_size((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyt createFieldsds$  (t__name__t __module__R&R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR]s  tDuckycBs3eZhdd6dd6dd6dd6Zd„ZRS( tenditQualityitCommentit Copyrighticcsntt|dƒ|iƒV|didjodSt|dƒV|di}|ot|d|ƒVndS(Nttypeitsizetdata(RRt BLOCK_TYPER%R (R'R2((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)€s (R*R+R4R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR,ys  tAPP12cBseZdZd„ZRS(s~ The JPEG APP12 "Picture Info" segment was used by some older cameras, and contains ASCII-based meta information. ccs>t|dddddƒVx|ipt|dƒVqWdS(Ntduckyis"Ducky" stringRRsitem[](R teofR,(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)Žs (R*R+t__doc__R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR5‰st StartOfFramecBseZd„ZRS(ccs„t|dƒVt|dƒVt|dƒVt|dƒVxEt|diƒD]0}t|dƒVt|dƒVt|dƒVqLWdS(Nt precisiontheighttwidtht nr_componentsscomponent_id[]shigh[]slow[](RRtrangeR%(R'tindex((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)”s(R*R+R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR9“sR/cBseZd„ZRS(ccs"t|d|idddƒVdS(Ntcommentitstript(R R2(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)¡s(R*R+R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR/ st AdobeChunkcBs%eZhdd6dd6Zd„ZRS(sYCbCr (converted from RGB)isYCCK (converted from CMYK)iccsÒ|ii|idƒdjo t|d|iddƒVdSt|ddddd ƒVt|d d ƒVtt|d ƒhd t 6dt 6ƒVt |ddƒVt |ddƒVtt |ddƒ|iƒVdS(NitAdobetrawisRaw datatadobes"Adobe" stringRRtversionsDCT encoder versiontflag00sChop down or subsamplingtBlendtflags0_reserveditflags1itcolor_transformsColorspace transformation code(tstreamt readBytestabsolute_addressR R2R RRRtFalsetTrueR R RtCOLORSPACE_TRANSFORMATION(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)©s(R*R+RRR)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyRC¤s t StartOfScancBseZd„ZRS(ccs›t|dƒVxut|diƒD]`}t|dƒ}|Vd|ijo|dijnptdƒ‚nt|dƒVq"Wt|ddƒVdS(NR=scomponent_id[]is JPEG error: Invalid component-idsvalue[]REi(RR>R%RR (R'R?tcomp_id((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)¶s((R*R+R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyRSµstRestartIntervalcBseZd„ZRS(ccst|ddƒVdS(NtintervalsRestart interval(R(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)Âs(R*R+R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyRUÁstQuantizationTablecBseZd„Zd„ZRS(ccs¦t|ddƒVt|ddƒV|didjotd|diƒ‚n|dio t}nt}x0tdƒD]"}t|}||d|ƒVq|WdS(Ntis_16bitiR?s!Invalid quantification index (%s)i@s coeff[%u](RR%RRRtxrangetJPEG_NATURAL_ORDER(R't coeff_typeR?tnatural((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)Æs   cCsd|diS(NsQuantification table #%uR?(R%(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pytcreateDescriptionÔs(R*R+R)R](((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyRWÅs tDefineQuantizationTablecBseZd„ZRS(ccs-x&|i|ijot|dƒVqWdS(Nsqt[](t current_sizeR2RW(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)Øs(R*R+R)(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR^×st JpegChunkcBs‘eZdZdZdZdZdZh dGd6dHd6dId6d d efd6dde fd6dJd6dde fd6dde fd6dde fd6dde fd6ddefd 6d!d"efd#6d$d%efd&6Zh d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6Zx7eiƒD])\ZZdAdBeiƒefee<qDWdFdC„ZdD„ZdE„ZRS(KiØiÙiÚiÛiÝs huffman[]sDefine Huffman Table (DHT)iÄt start_imagesStart of image (SOI)t end_imagesEnd of image (EOI)t start_scansStart Of Scan (SOS)squantization[]sDefine Quantization Table (DQT)tnb_linesDefine number of Lines (DNL)iÜtrestart_intervalsDefine Restart Interval (DRI)tapp0tAPP0iàtexifs Exif metadataiátapp12R5iìt photoshopt PhotoshopiíRFs2Image encoding information for DCT filters (Adobe)iîs comment[]R/iþuBaselineiÀuExtended sequentialiÁu ProgressiveiÂuLosslessiÃuDifferential sequentialiÅuDifferential progressiveiÆuDifferential losslessiÇu&Extended sequential, arithmetic codingiÉuProgressive, arithmetic codingiÊuLossless, arithmetic codingiËu*Differential sequential, arithmetic codingiÍu+Differential progressive, arithmetic codingiÎu(Differential lossless, arithmetic codingiÏt start_framesStart of frame (%s)cCsÅti||||ƒ|di}|djoU|ii|iddƒ}|djod|_d|_t|_ qÁd|_ n=||i jo#|i |\|_|_|_ n d|_ dS(NR1iái itExifRhtEXIF( Rt__init__R%RMRNROt_namet _descriptionRt_parsertNonetTAG_INFO(R'tparenttnamet descriptionttagtbytes((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyRos       #ccsútt|ddƒtƒV|didjotdƒ‚ntt|ddƒtƒV|di}||i|ifjodSt|ddƒV|did }d |joD|io"|i|d d d|d ƒVqöt |d|dƒVndS(NtheadertHeaderiÿsJPEG: Invalid chunk header!R1tTypeR2tSizeiitcontents Chunk contentiR3tData( RRRR%RtTAG_SOItTAG_EOIRRrR (R'RxR2((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)s   "cCsd|diS(Ns Chunk: %sR1(tdisplay(R'((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR]$sN(s huffman[]sDefine Huffman Table (DHT)N(RasStart of image (SOI)N(RbsEnd of image (EOI)N(RdsDefine number of Lines (DNL)N(R*R+R€R�tTAG_SOStTAG_DQTtTAG_DRIRsRSR^RURRR5RRCR/RttSTART_OF_FRAMEt iteritemstkeyttexttlowerR9RoR)R](((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR`ÜsN  !  tJpegFilecBsyeZeZhdd6dd6dd6dd6dddfd 6dd6dd6dd6Zd„Zd„Zd„Zd„ZRS(tjpegtidtimagetcategorytjpgtfile_extu image/jpegtmimesÿØÿàisÿØÿásÿØÿîtmagiciitmin_sizes JPEG pictureRwtskiptsubfilecCs›|iiddƒdjodSy_xXt|ƒD]J\}}|di}|tijod||fS|djoPq1q1WWntj odSXtS(NiisÿØsInvalid file signatureR1s&Unknown chunk type: 0x%02X (chunk #%s)s%Unable to parse at least three chunks(RMRNt enumerateR%R`RtRRQ(R'R?tfieldt chunk_type((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pytvalidate8s    ccsöx?|ip4t|dƒ}|V|ditijoPqqW|idjo t‚nt}|i|id}|o\d|jo7|i i |iddƒdjot }|d8}nt |d|dƒVn|ot|dƒVndS( Nschunk[]R1iiisÿÙR3s JPEG data( R7R`R%Rƒt_sizeRstNotImplementedErrorRPR_RMRNRQR (R'tchunkthas_endR2((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR)Gs$    #cCsGd}d|jo0|d}|d|di|dif7}n|S(Ns JPEG pictures sof/contents: %ux%u pixelsR<R;(R%(R'tdescRz((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR]^s   &cCsyd|jo|di|diSd|jodS|di}|iid|tdƒ}|dj o |dSdS(NR-R3sÿÙii(ROR2RsRMt searchBytest MAX_FILESIZE(R'tstartR-((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pytcreateContentSizees     (R�RŒ(u image/jpeg(sÿØÿài(sÿØÿái(sÿØÿîii°( R*R+Rtendiant PARSER_TAGSRšR)R]R£(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyR‹'s      Ni�i@(eiüi÷i¤iPi ißi¾i§i”i…ixioiei_iXiRiMiIiEi;i+iiiiîiÚiÉi·i¨iši�i‚iuili_iUiNiDi=i5i+i&iiii iiiûi÷ióiíièiãiÞiÙiÕiÏiÊiÆiÀi¼i·i±i­i¨i£i�i™i”i�i‹i„i€i}iwisilihici^iZiTiOiJiFi@i;i7i1i-i(i"iiiii iii(ei€i{i ~i{iÉwiltiÚqi·oiÈmiliYjiehibfitdi˜biÕ`i5_iŠ]i\i>Yi)UijQiíMi±JiÒGióDifBiÝ?i¸=i�;i¿9iñ7i#6iß4i3iž1i‡0i/i.iù,i+iË*i´)i˜(ià'iÈ&i&i\%i™$ié#i9#iv"i¿!i !iN i”iØiigi³iôiAi„iÏii\i¦iëi4iwi¹iiQi�iiZi˜iái0iriµ iþ iC i� i× i ie i¨iõi6i‚iËiiUiŸißi*iwiÉi€i(eiþiùi¦i|iciRiFi>i7i1i,i)i%i#i iiiiiiiiiiiûióiéiáiÚiÓiÍiÆiÁiºiµi±i¬i¨i¤ižiœi˜i”i‘iŽi‹iˆi…iƒi�i~i{ixivisiqinikiiifidiai^i\iYiWiSiQiOiLiJiFiDiBi?i=i9i7i4i2i0i,i*i'i%i"iiiiiiii i iiiii(eiÀ?i»?iJ>i­;i?9iù6i75i®3i;2i1iÐ/iU.iÀ,iI+iÚ)ix(i+'iÏ%i˜$i`#iè!i‹ i;iôiÐi¬i§i¢iÉiíi3i|iÃi-ixiÞipiÝioiioi)i¸iFiüiŒiEiûi«ihi%iÕ i‹ iD iû i¯ ib i iÍ iˆ i: iô i§ ia i iÍ i… i: iòi£iXiiÌi{iBiíiœiTiiÅivi.iãi›iUiiÁiti.iài›iPii¹iqi$iÝi—iVi@i(@iiiii iii iii iii iii iii!i(i0i)i"iii iiiiii#i*i1i8i9i2i+i$iiiiii%i,i3i:i;i4i-i&ii'i.i5i<i=i6i/i7i>i?(.R8thachoir_core.errorRthachoir_parserRthachoir_core.fieldRRRRRRRR R R R thachoir_parser.image.commonR thachoir_core.endianRthachoir_core.text_handlerRRthachoir_parser.image.exifRt'hachoir_parser.image.photoshop_metadataRR¡tQUALITY_HASH_COLORtQUALITY_SUM_COLORtQUALITY_HASH_GRAYtQUALITY_SUM_GRAYRZRR,R5R9R/RCRSRURWR^R`R‹(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/jpeg.pyt<module> s’L   K
19,234
Python
.py
76
251.802632
1,203
0.432971
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,655
gif.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/gif.pyc
—Ú Œ »Mc @sÑdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZddklZddklZddklZddklZlZlZdZeZd#Zd efd ÑÉYZhd d6dd6dd6dd6Zhdd6Z dÑZ!dÑZ"dÑZ#dÑZ$dÑZ%defdÑÉYZ&defdÑÉYZ'defd ÑÉYZ(d!S($s- GIF picture parser. Author: Victor Stinner iˇˇˇˇ(tParser( tFieldSett ParserErrortEnumtUInt8tUInt16tBittBitst NullBytestStringt PascalString8t CharactertNullBitstRawBytes(t PaletteRGB(t LITTLE_ENDIAN(t humanDuration(t textHandlertdisplayHandlert hexadecimalipiditImagecBseZdÑZdÑZRS(ccs>t|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d d ÉVt|d d ÉVt|ddÉVt|ddÉVt|ddÉV|dio-dd|d i>}t|d|dÉVnt|ddÉVxOtoGt|ddÉ}|V|idjot|d|idÉVqÎPqÎWdS(NtlefttLeftttoptToptwidthtWidththeighttHeighttbppisBits / pixel minus onetnulitsortedsSorted??t interlaceds Interlaced?t has_local_mapsUse local color map?it local_mapsLocal color mapt code_sizesLZW Minimum Code Sizes block_len[]s Block Lengthisdata[]s Image Data( RRR RtvalueRRtTrueR (tselftnb_colortblen((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyt createFieldss(cCs0d|di|di|di|difS(NsImage: %ux%u pixels at (%u,%u)RRRR(R$(R&((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytcreateDescription1s(t__name__t __module__R)R*(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyRs sNo disposal specifiedisDo not disposeisRestore to background colorisRestore to previousis Loop countccs»t|ddÉVt|dÉV|di}|didjo_|djoRtt|dÉtÉV|didjot|dÉVq∞t|d d ÉVnt|d |ÉVt|d dd ÉVdS( Ntapp_namesApplication nametsizes NETSCAPE2.0it netscape_codeit loop_counttrawit terminatorsTerminator (0)(R RR$Rt NETSCAPE_CODERR R(tparentR.((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytparseApplicationExtensionAs !ccs≈t|ddÉVt|ddÉVt|ddÉVtt|ddÉtÉVt|d dÉV|did jotd ÉÇntt |d d Ét ÉVt|ddÉVt |dddÉVdS(NR.sBlock size (4)t has_transpsHas transparencyt user_inputs User inputtdisposal_methodis reserved[]isInvalid graphic control sizetdelaysDelay time in millisecondttranspsTransparent color indexR2isTerminator (0)( RRRRtDISPOSAL_METHODR R$RRRRR(R4((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytparseGraphicControlOsccsBx;to3t|dddÉ}|V|idjoPqqWdS(Ns comment[]tstrips i(R%R tlength(R4tfield((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyt parseComments]s ccs€t|ddÉVttddÉVttddÉVttddÉVttd d ÉVt|d d ÉVt|d dÉVt|ddÉVt|ddÉVx;to3t|dddÉ}|V|idjoPqúqúWdS(Nt block_sizes Block SizeRsText Grid LeftRs Text Grid TopRsText Grid WidthRsText Grid Heightt cell_widthsCharacter Cell Widtht cell_heightsCharacter Cell Heighttfg_colorsForeground Color Indextbg_colorsBackground Color Indexs comment[]R=s i(RRR&R%R R>(R4R?((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytparseTextExtensiondsccsSxLtoDt|ddÉ}|Vd|ijot|d|iÉVqPqWdS(Nssize[]sSize (in bytes)is content[](R%RR$R (R4R.((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytdefaultExtensionParsertst ExtensioncBsieZhdedfd6dedfd6dedfd6d ed fd 6Zd ÑZd ÑZdÑZ RS(s graphic_ctl[]sGraphic controli˘s comments[]tCommentsi˛s app_ext[]sApplication extensioniˇs text_ext[]sPlain text extensionicGs]ti||å|di}||ijo#|i|\|_|_|_n t|_dS(Ntcode(Rt__init__R$text_codet_nametparsert _descriptionRG(R&targsRJ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyRKÑs  #ccs=tt|ddÉtÉVx|i|ÉD] }|Vq*WdS(NRJsExtension code(RRRRN(R&R?((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyR)åscCsd|diS(NsExtension: function %stfunc(tdisplay(R&((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyR*ës( R+R,R<R@R5RFRLRKR)R*(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyRH}s  tScreenDescriptorcBseZdÑZdÑZRS(ccsít|ddÉVt|ddÉVt|dddÉVt|dd ÉVt|d dd ÉVt|d d ÉVt|ddÉVt|ddÉVdS(NRRRRRisBits per pixel minus onetreserveds (reserved)t color_ressColor resolution minus onet global_mapsHas global map?t backgroundsBackground colortpixel_aspect_ratiosPixel Aspect Ratio(RRRR(R&((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyR)ïscCs4d|did>}d|di|di|fS(NiRs)Screen descriptor: %ux%u pixels %u colorsRR(R$(R&tcolors((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyR*üs(R+R,R)R*(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyRSîs tGifFilecBsÅeZeZhdd6dd6dd6Zhdd6dd 6dd 6dd 6d!d6d"d#fd6dd6ZdÑZdÑZdÑZRS($RHt!Rt,t Terminatort;tgiftidtimagetcategorytfile_extu image/giftmimeiiii itmin_sizetGIF87aitGIF89atmagics GIF picturet descriptioncCsö|iiddÉd jodS|didjp|didjodSt|dijod |diSt|dijod |diStS( NiiRfRgs Wrong headers screen/widths screen/heightsInvalid image sizesImage width too big (%u)sImage height too big (%u)(RfRg(tstreamt readBytesR$t MAX_WIDTHt MAX_HEIGHTR%(R&((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytvalidateµs(ccsAt|dddddÉVt|dddddÉVt|dÉV|d io:|d id }t|d d |>d ÉV|d |_n d|_g|_xûtoñtt |ddÉ|i É}|V|i}|djot |dÉVqü|djot |dÉVqü|djoPqüt dt|ÉÉÇqüWdS(NRhisFile magic codetcharsettASCIItversions GIF versiontscreensscreen/global_maps screen/bppit color_maps Color maps separator[]sSeparator codeR[s extensions[]R\simage[]R^s!Wrong GIF image separator: 0x%02X(R RSR$RRstNonetimagesR%RR tseparator_nameRHRRtord(R&RRJ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyR)¿s*      cCsT|d}|i|i}|td}|iid||É}|o |dSdS(Nsimage[0]it;i(tabsolute_addressR.t MAX_FILE_SIZERjt searchBytesRt(R&R?tstarttendtpos((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pytcreateContentSize‹s  (R_(u image/gifi iii∏(sGIF87ai(sGIF89ai( R+R,RtendianRvt PARSER_TAGSRnR)R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyRZ§s     Niêi@()t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R thachoir_parser.image.commonRthachoir_core.endianRthachoir_core.toolsRthachoir_core.text_handlerRRRRlRmRzRR;R3R5R<R@RFRGRHRSRZ(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/gif.pyt<module>s2X       
10,434
Python
.py
56
185.214286
799
0.461746
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,656
tga.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/tga.py
""" Truevision Targa Graphic (TGA) picture parser. Author: Victor Stinner Creation: 18 december 2006 """ from hachoir_parser import Parser from hachoir_core.field import FieldSet, UInt8, UInt16, Enum, RawBytes from hachoir_core.endian import LITTLE_ENDIAN from hachoir_parser.image.common import PaletteRGB class Line(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["/width"].value * self["/bpp"].value def createFields(self): for x in xrange(self["/width"].value): yield UInt8(self, "pixel[]") class Pixels(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["/width"].value * self["/height"].value * self["/bpp"].value def createFields(self): if self["/options"].value == 0: RANGE = xrange(self["/height"].value-1,-1,-1) else: RANGE = xrange(self["/height"].value) for y in RANGE: yield Line(self, "line[%u]" % y) class TargaFile(Parser): PARSER_TAGS = { "id": "targa", "category": "image", "file_ext": ("tga",), "mime": (u"image/targa", u"image/tga", u"image/x-tga"), "min_size": 18*8, "description": u"Truevision Targa Graphic (TGA)" } CODEC_NAME = { 1: u"8-bit uncompressed", 2: u"24-bit uncompressed", 9: u"8-bit RLE", 10: u"24-bit RLE", } endian = LITTLE_ENDIAN def validate(self): if self["version"].value != 1: return "Unknown version" if self["codec"].value not in self.CODEC_NAME: return "Unknown codec" if self["x_min"].value != 0 or self["y_min"].value != 0: return "(x_min, y_min) is not (0,0)" if self["bpp"].value not in (8, 24): return "Unknown bits/pixel value" return True def createFields(self): yield UInt8(self, "hdr_size", "Header size in bytes") yield UInt8(self, "version", "Targa version (always one)") yield Enum(UInt8(self, "codec", "Pixels encoding"), self.CODEC_NAME) yield UInt16(self, "palette_ofs", "Palette absolute file offset") yield UInt16(self, "nb_color", "Number of color") yield UInt8(self, "color_map_size", "Color map entry size") yield UInt16(self, "x_min") yield UInt16(self, "y_min") yield UInt16(self, "width") yield UInt16(self, "height") yield UInt8(self, "bpp", "Bits per pixel") yield UInt8(self, "options", "Options (0: vertical mirror)") if self["bpp"].value == 8: yield PaletteRGB(self, "palette", 256) if self["codec"].value == 1: yield Pixels(self, "pixels") else: size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "raw_pixels", size)
2,911
Python
.py
74
31.283784
86
0.58351
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,657
photoshop_metadata.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/photoshop_metadata.pyc
Ñò Î ÈMc@sØddklZlZlZlZlZlZlZlZl Z l Z ddk l Z l Z ddklZlZddklZddklZdefd„ƒYZdefd „ƒYZd efd „ƒYZd S( iÿÿÿÿ( tFieldSett ParserErrortUInt8tUInt16tUInt32tStringtCStringt PascalString8t NullBytestRawBytes(t textHandlert hexadecimal(t alignValuet createDict(tIPTC(tPascalStringWin32tVersioncBseZd„ZRS(ccs†t|dƒVt|dƒVt|dddƒVt|dddƒVt|dƒV|i|id}|ot|d |ƒVndS( Ntversiont has_realmt writer_nametcharsets UTF-16-BEt reader_namet file_versionitpadding(RRRtsizet current_sizeR(tselfR((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyt createFields s(t__name__t __module__R(((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyR st Photoshop8BIMcBsÖeZhd9d6d:d6d;d6d<d 6d ed fd6d=d6d>d6d?d6d@d6dAd6dBd 6dCd#6dDd&6dEd)6dFd,6d-ed.fd/6dGd26Zeed3ƒZeed4ƒZeed5ƒZ d6„Z d7„Z RS(Htres_infosResolution informationiít print_flags2Print flags: labels, crop marks, colour bars, etc.iót col_half_infosColour half-toning informationiõtcolor_trans_funcsColour transfer functioniøtiptcsIPTC/NAAit jpeg_quals JPEG qualityit grid_guidesGrid guides informationsitcopyright_flagsCopyright flagi t thumb_res2sThumbnail resource (2)i t glob_angles!Global lighting angle for effectsi t icc_taggeds-ICC untagged (1 means intentionally untagged)it base_layer_idsBase value for new layers ID'sit glob_altitudesGlobal altitudeitslicestSlicesiturl_lists Unicode URL'siRsVersion informationi!t print_flag2sPrint flags (2)i'iiicOs‘ti|||Žy*|i|di\|_|_|_Wntj od|_nX|d}|i |i t |idƒd|_ dS(NttagRii( Rt__init__tTAG_INFOtvaluet_namethandlert _descriptiontKeyErrortNonetaddressRR t_size(RtargstkwR((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyR1-s* ccs<t|dddddƒV|didjotdƒ‚ntt|dƒtƒV|ii|i|i dƒd jo<t |d ƒVd |d i d d }t |d |ƒVnt|d dddƒVt|dƒVt |did ƒ}|pdS|io|i|dd|d ƒVnt|d|ƒVdS(Nt signatureis8BIM signatureRtASCIIt8BIMs5Stream doesn't look like 8BIM item (wrong signature)!R0ttnameiit name_paddingtstriptRtcontent(RR3RR RR tstreamt readBytestabsolute_addressRRRRR R5R (RR((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyR6s & N(RNsResolution information(R Ns2Print flags: labels, crop marks, colour bars, etc.(R!NsColour half-toning information(R"NsColour transfer function(R$Ns JPEG quality(R%NsGrid guides informations(R&NsCopyright flag(R'NsThumbnail resource (2)(R(Ns!Global lighting angle for effects(R)Ns-ICC untagged (1 means intentionally untagged)(R*NsBase value for new layers ID's(R+NsGlobal altitude(R,NR-(R.Ns Unicode URL's(R/NsPrint flags (2)( RRR8RRR2R tTAG_NAMEtCONTENT_HANDLERtTAG_DESCR1R(((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyRs.  tPhotoshopMetadatacBseZd„ZRS(ccsrt|ddƒV|didjo$xF|ipt|dƒVq(Wn&|i|id}t|d|ƒVdS(NR=sPhotoshop versions Photoshop 3.0sitem[]itrawdata(RR3teofRR:RR (RR((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyRKs (RRR(((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyRLJsN(thachoir_core.fieldRRRRRRRRRR thachoir_core.text_handlerR R thachoir_core.toolsR R thachoir_parser.image.iptcRthachoir_parser.common.win32RRRRL(((sQ/pentest/enumeration/google/metagoofil/hachoir_parser/image/photoshop_metadata.pyt<module>sF 5
5,411
Python
.py
30
179.366667
840
0.501858
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,658
ico.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/ico.pyc
Ñò Î ÈMc@sÀdZddklZddklZlZlZlZlZl Z l Z ddk l Z ddk lZddklZdefd„ƒYZd efd „ƒYZd efd „ƒYZd S(sO Microsoft Windows icon and cursor file format parser. Author: Victor Stinner iÿÿÿÿ(tParser(tFieldSett ParserErrortUInt8tUInt16tUInt32tEnumtRawBytes(t PaletteRGBA(t LITTLE_ENDIAN(tBitmapInfoHeadert IconHeadercBs#eZd„Zd„Zd„ZRS(ccsŒt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d ƒVt|d d ƒVt|d dƒVt|ddƒVdS(NtwidthtWidththeighttHeighttnb_colorsNumber of colorstreserveds (reserved)tplanessColor planes (=1)tbppsBits per pixeltsizesContent size in bytestoffsets Data offset(RRR(tself((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyt createFieldsscCs&d|di|di|difS(Ns!Icon: %ux%u pixels, %u bits/pixelR RR(tvalue(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pytcreateDescriptionscCsì|didjo^|did jo|didjotS|did jo|didjotSnJ|did jo1|did jo|didjotSntS|didjo|didjotStS( NRiRiii Riii(iii (ii(RtTruetFalse(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pytisValids(( ( ((t__name__t __module__RRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyR s tIconDatacBseZd„Zd„ZRS(cCs#ti|||dƒ||_dS(Ns Icon data(Rt__init__theader(RtparenttnameR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyR -sccs”t|dƒV|idi}|ididjo d}n|djot|d|ƒVn|idi|id}t|d |d ƒVdS( NR!RRiiitpaletteRtpixelss Image pixels(R R!RRt current_sizeR(RRR((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyR1s  (RRR R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyR,s tIcoFilecBs}eZeZhdd6dd6dd6dd6dd 6dd6dd6Zhdd6dd6Zd„Zd„Zd„Zd„Z RS(ticotidtimagetcategorytcurtfile_extu image/x-icotmimeii(itmin_sizet+[][-].(| |00|@@)[][][ ]it magic_regexs Microsoft Windows icon or cursort descriptionticonitcursoricCs™|didjodS|di|ijodSd}xW|D]O}|iidƒo$|d7}|iƒp d |SqBd|joPqBqBWtS( Nt signatureisWrong file signaturettypesUnknown picture typeiÿÿÿÿt icon_headerisInvalid header #%u(Rt TYPE_NAMER#t startswithRR(Rtindextfield((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pytvalidateZs     ccsÕt|ddƒVtt|ddƒ|iƒVt|ddƒVg}x<t|diƒD]'}t|dƒ}|V|i|ƒqYWxJ|D]B}|did |ijotd ƒ‚nt |d |ƒVq‹WdS( NR5sSignature (0x0000)R6s Resource typetnb_itemssNumber of itemss icon_header[]Ris$Icon: Problem with icon data offset.s icon_data[]( RRR8txrangeRR tappendR&RR(RtitemsR:titemR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyRlscCs‡d|di}g}xF|idƒD]5}|id|di|di|difƒq'W|od|d i|ƒfS|SdS( NsMicrosoft Windows %sR6R7s%ux%ux%uR RRs%s: %ss, (tdisplaytarrayR?Rtjoin(RtdescRR!((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyRzs cCs9|di}|pdS|d|d}|i|iS(NR=s icon_data[%u]i(RtNonetabsolute_addressR(RtcountR;((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pytcreateContentSize…s  (R(R,(u image/x-icoi>ið(R0i((R0i( RRR tendiant PARSER_TAGSR8R<RRRI(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyR'?s"     N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRthachoir_parser.image.commonRthachoir_core.endianR thachoir_parser.common.win32R R RR'(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/ico.pyt<module>s4
5,871
Python
.py
29
201.344828
740
0.435981
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,659
__init__.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/__init__.py
from hachoir_parser.image.bmp import BmpFile from hachoir_parser.image.gif import GifFile from hachoir_parser.image.ico import IcoFile from hachoir_parser.image.jpeg import JpegFile from hachoir_parser.image.pcx import PcxFile from hachoir_parser.image.psd import PsdFile from hachoir_parser.image.png import PngFile from hachoir_parser.image.tga import TargaFile from hachoir_parser.image.tiff import TiffFile from hachoir_parser.image.wmf import WMF_File from hachoir_parser.image.xcf import XcfFile
503
Python
.py
11
44.636364
46
0.863544
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,660
iptc.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/iptc.py
""" IPTC metadata parser (can be found in a JPEG picture for example) Sources: - Image-MetaData Perl module: http://www.annocpan.org/~BETTELLI/Image-MetaData-JPEG-0.15/... ...lib/Image/MetaData/JPEG/TagLists.pod - IPTC tag name and description: http://peccatte.karefil.com/software/IPTCTableau.pdf Author: Victor Stinner """ from hachoir_core.field import (FieldSet, ParserError, UInt8, UInt16, String, RawBytes, NullBytes) from hachoir_core.text_handler import textHandler, hexadecimal def IPTC_String(parent, name, desc=None): # Charset may be utf-8, ISO-8859-1, or ... return String(parent, name, parent["size"].value, desc, strip=" ") dataset1 = { } dataset2 = { 0: ("record_version", "Record version (2 for JPEG)", UInt16), 5: ("obj_name", "Object name", None), 7: ("edit_stat", "Edit status", None), 10: ("urgency", "Urgency", UInt8), 15: ("category[]", "Category", None), 22: ("fixture", "Fixture identifier", IPTC_String), 25: ("keyword[]", "Keywords", IPTC_String), 30: ("release_date", "Release date", IPTC_String), 35: ("release_time", "Release time", IPTC_String), 40: ("instruction", "Special instructions", IPTC_String), 55: ("date_created", "Date created", IPTC_String), 60: ("time_created", "Time created (ISO 8601)", IPTC_String), 65: ("originating_prog", "Originating program", IPTC_String), 70: ("prog_ver", "Program version", IPTC_String), 80: ("author", "By-line (Author)", IPTC_String), 85: ("author_job", "By-line (Author precision)", IPTC_String), 90: ("city", "City", IPTC_String), 95: ("state", "Province / State", IPTC_String), 100: ("country_code", "Country / Primary location code", IPTC_String), 101: ("country_name", "Country / Primary location name", IPTC_String), 103: ("trans_ref", "Original transmission reference", IPTC_String), 105: ("headline", "Headline", IPTC_String), 110: ("credit", "Credit", IPTC_String), 115: ("source", "Source", IPTC_String), 116: ("copyright", "Copyright notice", IPTC_String), 120: ("caption", "Caption/Abstract", IPTC_String), 122: ("writer", "Writer/editor", IPTC_String), 231: ("history[]", "Document history (timestamp)", IPTC_String) } datasets = {1: dataset1, 2: dataset2} class IPTC_Size(FieldSet): def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) value = 0 for field in self: value <<= 15 value += (field.value & 0x7fff) self.createValue = lambda: value def createFields(self): while True: field = UInt16(self, "value[]") yield field if field.value < 0x8000: break class IPTC_Chunk(FieldSet): def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) number = self["dataset_nb"].value self.dataset_info = None if number in datasets: tag = self["tag"].value if tag in datasets[number]: self.dataset_info = datasets[number][tag] self._name = self.dataset_info[0] self._description = self.dataset_info[1] size_chunk = self["size"] self._size = 3*8 + size_chunk.size + size_chunk.value*8 def createFields(self): yield textHandler(UInt8(self, "signature", "IPTC signature (0x1c)"), hexadecimal) if self["signature"].value != 0x1C: raise ParserError("Wrong IPTC signature") yield textHandler(UInt8(self, "dataset_nb", "Dataset number"), hexadecimal) yield UInt8(self, "tag", "Tag") yield IPTC_Size(self, "size", "Content size") size = self["size"].value if 0 < size: if self.dataset_info: cls = self.dataset_info[2] else: cls = None if cls: yield cls(self, "content") else: yield RawBytes(self, "content", size) class IPTC(FieldSet): def createFields(self): while 5 <= (self._size - self.current_size)/8: yield IPTC_Chunk(self, "chunk[]") size = (self._size - self.current_size) / 8 if 0 < size: yield NullBytes(self, "padding", size)
4,291
Python
.py
101
35
89
0.603638
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,661
wmf.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/wmf.py
""" Hachoir parser of Microsoft Windows Metafile (WMF) file format. Documentation: - Microsoft Windows Metafile; also known as: WMF, Enhanced Metafile, EMF, APM http://wvware.sourceforge.net/caolan/ora-wmf.html - libwmf source code: - include/libwmf/defs.h: enums - src/player/meta.h: arguments parsers - libemf source code Author: Victor Stinner Creation date: 26 december 2006 """ MAX_FILESIZE = 50 * 1024 * 1024 from hachoir_parser import Parser from hachoir_core.field import (FieldSet, StaticFieldSet, Enum, MissingField, ParserError, UInt32, Int32, UInt16, Int16, UInt8, NullBytes, RawBytes, String) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.tools import createDict from hachoir_parser.image.common import RGBA POLYFILL_MODE = {1: "Alternate", 2: "Winding"} BRUSH_STYLE = { 0: u"Solid", 1: u"Null", 2: u"Hollow", 3: u"Pattern", 4: u"Indexed", 5: u"DIB pattern", 6: u"DIB pattern point", 7: u"Pattern 8x8", 8: u"DIB pattern 8x8", } HATCH_STYLE = { 0: u"Horizontal", # ----- 1: u"Vertical", # ||||| 2: u"FDIAGONAL", # \\\\\ 3: u"BDIAGONAL", # ///// 4: u"Cross", # +++++ 5: u"Diagonal cross", # xxxxx } PEN_STYLE = { 0: u"Solid", 1: u"Dash", # ------- 2: u"Dot", # ....... 3: u"Dash dot", # _._._._ 4: u"Dash dot dot", # _.._.._ 5: u"Null", 6: u"Inside frame", 7: u"User style", 8: u"Alternate", } # Binary raster operations ROP2_DESC = { 1: u"Black (0)", 2: u"Not merge pen (DPon)", 3: u"Mask not pen (DPna)", 4: u"Not copy pen (PN)", 5: u"Mask pen not (PDna)", 6: u"Not (Dn)", 7: u"Xor pen (DPx)", 8: u"Not mask pen (DPan)", 9: u"Mask pen (DPa)", 10: u"Not xor pen (DPxn)", 11: u"No operation (D)", 12: u"Merge not pen (DPno)", 13: u"Copy pen (P)", 14: u"Merge pen not (PDno)", 15: u"Merge pen (DPo)", 16: u"White (1)", } def parseXY(parser): yield Int16(parser, "x") yield Int16(parser, "y") def parseCreateBrushIndirect(parser): yield Enum(UInt16(parser, "brush_style"), BRUSH_STYLE) yield RGBA(parser, "color") yield Enum(UInt16(parser, "brush_hatch"), HATCH_STYLE) def parsePenIndirect(parser): yield Enum(UInt16(parser, "pen_style"), PEN_STYLE) yield UInt16(parser, "pen_width") yield UInt16(parser, "pen_height") yield RGBA(parser, "color") def parsePolyFillMode(parser): yield Enum(UInt16(parser, "operation"), POLYFILL_MODE) def parseROP2(parser): yield Enum(UInt16(parser, "operation"), ROP2_DESC) def parseObjectID(parser): yield UInt16(parser, "object_id") class Point(FieldSet): static_size = 32 def createFields(self): yield Int16(self, "x") yield Int16(self, "y") def createDescription(self): return "Point (%s, %s)" % (self["x"].value, self["y"].value) def parsePolygon(parser): yield UInt16(parser, "count") for index in xrange(parser["count"].value): yield Point(parser, "point[]") META = { 0x0000: ("EOF", u"End of file", None), 0x001E: ("SAVEDC", u"Save device context", None), 0x0035: ("REALIZEPALETTE", u"Realize palette", None), 0x0037: ("SETPALENTRIES", u"Set palette entries", None), 0x00f7: ("CREATEPALETTE", u"Create palette", None), 0x0102: ("SETBKMODE", u"Set background mode", None), 0x0103: ("SETMAPMODE", u"Set mapping mode", None), 0x0104: ("SETROP2", u"Set foreground mix mode", parseROP2), 0x0106: ("SETPOLYFILLMODE", u"Set polygon fill mode", parsePolyFillMode), 0x0107: ("SETSTRETCHBLTMODE", u"Set bitmap streching mode", None), 0x0108: ("SETTEXTCHAREXTRA", u"Set text character extra", None), 0x0127: ("RESTOREDC", u"Restore device context", None), 0x012A: ("INVERTREGION", u"Invert region", None), 0x012B: ("PAINTREGION", u"Paint region", None), 0x012C: ("SELECTCLIPREGION", u"Select clipping region", None), 0x012D: ("SELECTOBJECT", u"Select object", parseObjectID), 0x012E: ("SETTEXTALIGN", u"Set text alignment", None), 0x0142: ("CREATEDIBPATTERNBRUSH", u"Create DIB brush with specified pattern", None), 0x01f0: ("DELETEOBJECT", u"Delete object", parseObjectID), 0x0201: ("SETBKCOLOR", u"Set background color", None), 0x0209: ("SETTEXTCOLOR", u"Set text color", None), 0x020A: ("SETTEXTJUSTIFICATION", u"Set text justification", None), 0x020B: ("SETWINDOWORG", u"Set window origin", parseXY), 0x020C: ("SETWINDOWEXT", u"Set window extends", parseXY), 0x020D: ("SETVIEWPORTORG", u"Set view port origin", None), 0x020E: ("SETVIEWPORTEXT", u"Set view port extends", None), 0x020F: ("OFFSETWINDOWORG", u"Offset window origin", None), 0x0211: ("OFFSETVIEWPORTORG", u"Offset view port origin", None), 0x0213: ("LINETO", u"Draw a line to", None), 0x0214: ("MOVETO", u"Move to", None), 0x0220: ("OFFSETCLIPRGN", u"Offset clipping rectangle", None), 0x0228: ("FILLREGION", u"Fill region", None), 0x0231: ("SETMAPPERFLAGS", u"Set mapper flags", None), 0x0234: ("SELECTPALETTE", u"Select palette", None), 0x02FB: ("CREATEFONTINDIRECT", u"Create font indirect", None), 0x02FA: ("CREATEPENINDIRECT", u"Create pen indirect", parsePenIndirect), 0x02FC: ("CREATEBRUSHINDIRECT", u"Create brush indirect", parseCreateBrushIndirect), 0x0324: ("POLYGON", u"Draw a polygon", parsePolygon), 0x0325: ("POLYLINE", u"Draw a polyline", None), 0x0410: ("SCALEWINDOWEXT", u"Scale window extends", None), 0x0412: ("SCALEVIEWPORTEXT", u"Scale view port extends", None), 0x0415: ("EXCLUDECLIPRECT", u"Exclude clipping rectangle", None), 0x0416: ("INTERSECTCLIPRECT", u"Intersect clipping rectangle", None), 0x0418: ("ELLIPSE", u"Draw an ellipse", None), 0x0419: ("FLOODFILL", u"Flood fill", None), 0x041B: ("RECTANGLE", u"Draw a rectangle", None), 0x041F: ("SETPIXEL", u"Set pixel", None), 0x0429: ("FRAMEREGION", u"Fram region", None), 0x0521: ("TEXTOUT", u"Draw text", None), 0x0538: ("POLYPOLYGON", u"Draw multiple polygons", None), 0x0548: ("EXTFLOODFILL", u"Extend flood fill", None), 0x061C: ("ROUNDRECT", u"Draw a rounded rectangle", None), 0x061D: ("PATBLT", u"Pattern blitting", None), 0x0626: ("ESCAPE", u"Escape", None), 0x06FF: ("CREATEREGION", u"Create region", None), 0x0817: ("ARC", u"Draw an arc", None), 0x081A: ("PIE", u"Draw a pie", None), 0x0830: ("CHORD", u"Draw a chord", None), 0x0940: ("DIBBITBLT", u"DIB bit blitting", None), 0x0a32: ("EXTTEXTOUT", u"Draw text (extra)", None), 0x0b41: ("DIBSTRETCHBLT", u"DIB stretch blitting", None), 0x0d33: ("SETDIBTODEV", u"Set DIB to device", None), 0x0f43: ("STRETCHDIB", u"Stretch DIB", None), } META_NAME = createDict(META, 0) META_DESC = createDict(META, 1) #---------------------------------------------------------------------------- # EMF constants # EMF mapping modes EMF_MAPPING_MODE = { 1: "TEXT", 2: "LOMETRIC", 3: "HIMETRIC", 4: "LOENGLISH", 5: "HIENGLISH", 6: "TWIPS", 7: "ISOTROPIC", 8: "ANISOTROPIC", } #---------------------------------------------------------------------------- # EMF parser def parseEmfMappingMode(parser): yield Enum(Int32(parser, "mapping_mode"), EMF_MAPPING_MODE) def parseXY32(parser): yield Int32(parser, "x") yield Int32(parser, "y") def parseObjectID32(parser): yield textHandler(UInt32(parser, "object_id"), hexadecimal) def parseBrushIndirect(parser): yield UInt32(parser, "ihBrush") yield UInt32(parser, "style") yield RGBA(parser, "color") yield Int32(parser, "hatch") class Point16(FieldSet): static_size = 32 def createFields(self): yield Int16(self, "x") yield Int16(self, "y") def createDescription(self): return "Point16: (%i,%i)" % (self["x"].value, self["y"].value) def parsePoint16array(parser): yield RECT32(parser, "bounds") yield UInt32(parser, "count") for index in xrange(parser["count"].value): yield Point16(parser, "point[]") def parseGDIComment(parser): yield UInt32(parser, "data_size") size = parser["data_size"].value if size: yield RawBytes(parser, "data", size) def parseICMMode(parser): yield UInt32(parser, "icm_mode") def parseExtCreatePen(parser): yield UInt32(parser, "ihPen") yield UInt32(parser, "offBmi") yield UInt32(parser, "cbBmi") yield UInt32(parser, "offBits") yield UInt32(parser, "cbBits") yield UInt32(parser, "pen_style") yield UInt32(parser, "width") yield UInt32(parser, "brush_style") yield RGBA(parser, "color") yield UInt32(parser, "hatch") yield UInt32(parser, "nb_style") for index in xrange(parser["nb_style"].value): yield UInt32(parser, "style") EMF_META = { 1: ("HEADER", u"Header", None), 2: ("POLYBEZIER", u"Draw poly bezier", None), 3: ("POLYGON", u"Draw polygon", None), 4: ("POLYLINE", u"Draw polyline", None), 5: ("POLYBEZIERTO", u"Draw poly bezier to", None), 6: ("POLYLINETO", u"Draw poly line to", None), 7: ("POLYPOLYLINE", u"Draw poly polyline", None), 8: ("POLYPOLYGON", u"Draw poly polygon", None), 9: ("SETWINDOWEXTEX", u"Set window extend EX", parseXY32), 10: ("SETWINDOWORGEX", u"Set window origin EX", parseXY32), 11: ("SETVIEWPORTEXTEX", u"Set viewport extend EX", parseXY32), 12: ("SETVIEWPORTORGEX", u"Set viewport origin EX", parseXY32), 13: ("SETBRUSHORGEX", u"Set brush org EX", None), 14: ("EOF", u"End of file", None), 15: ("SETPIXELV", u"Set pixel V", None), 16: ("SETMAPPERFLAGS", u"Set mapper flags", None), 17: ("SETMAPMODE", u"Set mapping mode", parseEmfMappingMode), 18: ("SETBKMODE", u"Set background mode", None), 19: ("SETPOLYFILLMODE", u"Set polyfill mode", None), 20: ("SETROP2", u"Set ROP2", None), 21: ("SETSTRETCHBLTMODE", u"Set stretching blitting mode", None), 22: ("SETTEXTALIGN", u"Set text align", None), 23: ("SETCOLORADJUSTMENT", u"Set color adjustment", None), 24: ("SETTEXTCOLOR", u"Set text color", None), 25: ("SETBKCOLOR", u"Set background color", None), 26: ("OFFSETCLIPRGN", u"Offset clipping region", None), 27: ("MOVETOEX", u"Move to EX", parseXY32), 28: ("SETMETARGN", u"Set meta region", None), 29: ("EXCLUDECLIPRECT", u"Exclude clipping rectangle", None), 30: ("INTERSECTCLIPRECT", u"Intersect clipping rectangle", None), 31: ("SCALEVIEWPORTEXTEX", u"Scale viewport extend EX", None), 32: ("SCALEWINDOWEXTEX", u"Scale window extend EX", None), 33: ("SAVEDC", u"Save device context", None), 34: ("RESTOREDC", u"Restore device context", None), 35: ("SETWORLDTRANSFORM", u"Set world transform", None), 36: ("MODIFYWORLDTRANSFORM", u"Modify world transform", None), 37: ("SELECTOBJECT", u"Select object", parseObjectID32), 38: ("CREATEPEN", u"Create pen", None), 39: ("CREATEBRUSHINDIRECT", u"Create brush indirect", parseBrushIndirect), 40: ("DELETEOBJECT", u"Delete object", parseObjectID32), 41: ("ANGLEARC", u"Draw angle arc", None), 42: ("ELLIPSE", u"Draw ellipse", None), 43: ("RECTANGLE", u"Draw rectangle", None), 44: ("ROUNDRECT", u"Draw rounded rectangle", None), 45: ("ARC", u"Draw arc", None), 46: ("CHORD", u"Draw chord", None), 47: ("PIE", u"Draw pie", None), 48: ("SELECTPALETTE", u"Select palette", None), 49: ("CREATEPALETTE", u"Create palette", None), 50: ("SETPALETTEENTRIES", u"Set palette entries", None), 51: ("RESIZEPALETTE", u"Resize palette", None), 52: ("REALIZEPALETTE", u"Realize palette", None), 53: ("EXTFLOODFILL", u"EXT flood fill", None), 54: ("LINETO", u"Draw line to", parseXY32), 55: ("ARCTO", u"Draw arc to", None), 56: ("POLYDRAW", u"Draw poly draw", None), 57: ("SETARCDIRECTION", u"Set arc direction", None), 58: ("SETMITERLIMIT", u"Set miter limit", None), 59: ("BEGINPATH", u"Begin path", None), 60: ("ENDPATH", u"End path", None), 61: ("CLOSEFIGURE", u"Close figure", None), 62: ("FILLPATH", u"Fill path", None), 63: ("STROKEANDFILLPATH", u"Stroke and fill path", None), 64: ("STROKEPATH", u"Stroke path", None), 65: ("FLATTENPATH", u"Flatten path", None), 66: ("WIDENPATH", u"Widen path", None), 67: ("SELECTCLIPPATH", u"Select clipping path", None), 68: ("ABORTPATH", u"Arbort path", None), 70: ("GDICOMMENT", u"GDI comment", parseGDIComment), 71: ("FILLRGN", u"Fill region", None), 72: ("FRAMERGN", u"Frame region", None), 73: ("INVERTRGN", u"Invert region", None), 74: ("PAINTRGN", u"Paint region", None), 75: ("EXTSELECTCLIPRGN", u"EXT select clipping region", None), 76: ("BITBLT", u"Bit blitting", None), 77: ("STRETCHBLT", u"Stretch blitting", None), 78: ("MASKBLT", u"Mask blitting", None), 79: ("PLGBLT", u"PLG blitting", None), 80: ("SETDIBITSTODEVICE", u"Set DIB bits to device", None), 81: ("STRETCHDIBITS", u"Stretch DIB bits", None), 82: ("EXTCREATEFONTINDIRECTW", u"EXT create font indirect W", None), 83: ("EXTTEXTOUTA", u"EXT text out A", None), 84: ("EXTTEXTOUTW", u"EXT text out W", None), 85: ("POLYBEZIER16", u"Draw poly bezier (16-bit)", None), 86: ("POLYGON16", u"Draw polygon (16-bit)", parsePoint16array), 87: ("POLYLINE16", u"Draw polyline (16-bit)", parsePoint16array), 88: ("POLYBEZIERTO16", u"Draw poly bezier to (16-bit)", parsePoint16array), 89: ("POLYLINETO16", u"Draw polyline to (16-bit)", parsePoint16array), 90: ("POLYPOLYLINE16", u"Draw poly polyline (16-bit)", None), 91: ("POLYPOLYGON16", u"Draw poly polygon (16-bit)", parsePoint16array), 92: ("POLYDRAW16", u"Draw poly draw (16-bit)", None), 93: ("CREATEMONOBRUSH", u"Create monobrush", None), 94: ("CREATEDIBPATTERNBRUSHPT", u"Create DIB pattern brush PT", None), 95: ("EXTCREATEPEN", u"EXT create pen", parseExtCreatePen), 96: ("POLYTEXTOUTA", u"Poly text out A", None), 97: ("POLYTEXTOUTW", u"Poly text out W", None), 98: ("SETICMMODE", u"Set ICM mode", parseICMMode), 99: ("CREATECOLORSPACE", u"Create color space", None), 100: ("SETCOLORSPACE", u"Set color space", None), 101: ("DELETECOLORSPACE", u"Delete color space", None), 102: ("GLSRECORD", u"GLS record", None), 103: ("GLSBOUNDEDRECORD", u"GLS bound ED record", None), 104: ("PIXELFORMAT", u"Pixel format", None), } EMF_META_NAME = createDict(EMF_META, 0) EMF_META_DESC = createDict(EMF_META, 1) class Function(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) if self.root.isEMF(): self._size = self["size"].value * 8 else: self._size = self["size"].value * 16 def createFields(self): if self.root.isEMF(): yield Enum(UInt32(self, "function"), EMF_META_NAME) yield UInt32(self, "size") try: parser = EMF_META[self["function"].value][2] except KeyError: parser = None else: yield UInt32(self, "size") yield Enum(UInt16(self, "function"), META_NAME) try: parser = META[self["function"].value][2] except KeyError: parser = None if parser: for field in parser(self): yield field else: size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "data", size) def isValid(self): func = self["function"] return func.value in func.getEnum() def createDescription(self): if self.root.isEMF(): return EMF_META_DESC[self["function"].value] try: return META_DESC[self["function"].value] except KeyError: return "Function %s" % self["function"].display class RECT16(StaticFieldSet): format = ( (Int16, "left"), (Int16, "top"), (Int16, "right"), (Int16, "bottom"), ) def createDescription(self): return "%s: %ux%u at (%u,%u)" % ( self.__class__.__name__, self["right"].value-self["left"].value, self["bottom"].value-self["top"].value, self["left"].value, self["top"].value) class RECT32(RECT16): format = ( (Int32, "left"), (Int32, "top"), (Int32, "right"), (Int32, "bottom"), ) class PlaceableHeader(FieldSet): """ Header of Placeable Metafile (file extension .APM), created by Aldus Corporation """ MAGIC = "\xD7\xCD\xC6\x9A\0\0" # (magic, handle=0x0000) def createFields(self): yield textHandler(UInt32(self, "signature", "Placeable Metafiles signature (0x9AC6CDD7)"), hexadecimal) yield UInt16(self, "handle") yield RECT16(self, "rect") yield UInt16(self, "inch") yield NullBytes(self, "reserved", 4) yield textHandler(UInt16(self, "checksum"), hexadecimal) class EMF_Header(FieldSet): MAGIC = "\x20\x45\x4D\x46\0\0" # (magic, min_ver=0x0000) def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["size"].value * 8 def createFields(self): LONG = Int32 yield UInt32(self, "type", "Record type (always 1)") yield UInt32(self, "size", "Size of the header in bytes") yield RECT32(self, "Bounds", "Inclusive bounds") yield RECT32(self, "Frame", "Inclusive picture frame") yield textHandler(UInt32(self, "signature", "Signature ID (always 0x464D4520)"), hexadecimal) yield UInt16(self, "min_ver", "Minor version") yield UInt16(self, "maj_ver", "Major version") yield UInt32(self, "file_size", "Size of the file in bytes") yield UInt32(self, "NumOfRecords", "Number of records in the metafile") yield UInt16(self, "NumOfHandles", "Number of handles in the handle table") yield NullBytes(self, "reserved", 2) yield UInt32(self, "desc_size", "Size of description in 16-bit words") yield UInt32(self, "desc_ofst", "Offset of description string in metafile") yield UInt32(self, "nb_colors", "Number of color palette entries") yield LONG(self, "width_px", "Width of reference device in pixels") yield LONG(self, "height_px", "Height of reference device in pixels") yield LONG(self, "width_mm", "Width of reference device in millimeters") yield LONG(self, "height_mm", "Height of reference device in millimeters") # Read description (if any) offset = self["desc_ofst"].value current = (self.absolute_address + self.current_size) // 8 size = self["desc_size"].value * 2 if offset == current and size: yield String(self, "description", size, charset="UTF-16-LE", strip="\0 ") # Read padding (if any) size = self["size"].value - self.current_size//8 if size: yield RawBytes(self, "padding", size) class WMF_File(Parser): PARSER_TAGS = { "id": "wmf", "category": "image", "file_ext": ("wmf", "apm", "emf"), "mime": ( u"image/wmf", u"image/x-wmf", u"image/x-win-metafile", u"application/x-msmetafile", u"application/wmf", u"application/x-wmf", u"image/x-emf"), "magic": ( (PlaceableHeader.MAGIC, 0), (EMF_Header.MAGIC, 40*8), # WMF: file_type=memory, header size=9, version=3.0 ("\0\0\x09\0\0\3", 0), # WMF: file_type=disk, header size=9, version=3.0 ("\1\0\x09\0\0\3", 0), ), "min_size": 40*8, "description": u"Microsoft Windows Metafile (WMF)", } endian = LITTLE_ENDIAN FILE_TYPE = {0: "memory", 1: "disk"} def validate(self): if self.isEMF(): # Check EMF header emf = self["emf_header"] if emf["signature"].value != 0x464D4520: return "Invalid signature" if emf["type"].value != 1: return "Invalid record type" if emf["reserved"].value != "\0\0": return "Invalid reserved" FUNC_DICT = EMF_META_NAME else: # Check AMF header if self.isAPM(): amf = self["amf_header"] if amf["handle"].value != 0: return "Invalid handle" if amf["reserved"].value != "\0\0\0\0": return "Invalid reserved" # Check common header if self["file_type"].value not in (0, 1): return "Invalid file type" if self["header_size"].value != 9: return "Invalid header size" if self["nb_params"].value != 0: return "Invalid number of parameters" FUNC_DICT = META_NAME # Check first functions for index in xrange(5): try: func = self["func[%u]" % index] except MissingField: if self.done: return True return "Unable to get function #%u" % index except ParserError: return "Unable to create function #%u" % index # Check first frame values if not func.isValid(): return "Function #%u is invalid" % index return True def createFields(self): if self.isEMF(): yield EMF_Header(self, "emf_header") else: if self.isAPM(): yield PlaceableHeader(self, "amf_header") yield Enum(UInt16(self, "file_type"), self.FILE_TYPE) yield UInt16(self, "header_size", "Size of header in 16-bit words (always 9)") yield UInt8(self, "win_ver_min", "Minor version of Microsoft Windows") yield UInt8(self, "win_ver_maj", "Major version of Microsoft Windows") yield UInt32(self, "file_size", "Total size of the metafile in 16-bit words") yield UInt16(self, "nb_obj", "Number of objects in the file") yield UInt32(self, "max_record_size", "The size of largest record in 16-bit words") yield UInt16(self, "nb_params", "Not Used (always 0)") while not(self.eof): yield Function(self, "func[]") def isEMF(self): """File is in EMF format?""" if 1 <= self.current_length: return self[0].name == "emf_header" if self.size < 44*8: return False magic = EMF_Header.MAGIC return self.stream.readBytes(40*8, len(magic)) == magic def isAPM(self): """File is in Aldus Placeable Metafiles format?""" if 1 <= self.current_length: return self[0].name == "amf_header" else: magic = PlaceableHeader.MAGIC return (self.stream.readBytes(0, len(magic)) == magic) def createDescription(self): if self.isEMF(): return u"Microsoft Enhanced Metafile (EMF) picture" elif self.isAPM(): return u"Aldus Placeable Metafile (APM) picture" else: return u"Microsoft Windows Metafile (WMF) picture" def createMimeType(self): if self.isEMF(): return u"image/x-emf" else: return u"image/wmf" def createContentSize(self): if self.isEMF(): return None start = self["func[0]"].absolute_address end = self.stream.searchBytes("\3\0\0\0\0\0", start, MAX_FILESIZE * 8) if end is not None: return end + 6*8 return None
23,844
Python
.py
557
35.840215
111
0.61052
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,662
tiff.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/tiff.py
""" TIFF image parser. Authors: Victor Stinner and Sebastien Ponce Creation date: 30 september 2006 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, SeekableFieldSet, ParserError, RootSeekableFieldSet, UInt16, UInt32, Bytes, String) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_parser.image.exif import BasicIFDEntry from hachoir_core.tools import createDict MAX_COUNT = 250 class IFDEntry(BasicIFDEntry): static_size = 12*8 TAG_INFO = { 254: ("new_subfile_type", "New subfile type"), 255: ("subfile_type", "Subfile type"), 256: ("img_width", "Image width in pixels"), 257: ("img_height", "Image height in pixels"), 258: ("bits_per_sample", "Bits per sample"), 259: ("compression", "Compression method"), 262: ("photo_interpret", "Photometric interpretation"), 263: ("thres", "Thresholding"), 264: ("cell_width", "Cellule width"), 265: ("cell_height", "Cellule height"), 266: ("fill_order", "Fill order"), 269: ("doc_name", "Document name"), 270: ("description", "Image description"), 271: ("make", "Make"), 272: ("model", "Model"), 273: ("strip_ofs", "Strip offsets"), 274: ("orientation", "Orientation"), 277: ("sample_pixel", "Samples per pixel"), 278: ("row_per_strip", "Rows per strip"), 279: ("strip_byte", "Strip byte counts"), 280: ("min_sample_value", "Min sample value"), 281: ("max_sample_value", "Max sample value"), 282: ("xres", "X resolution"), 283: ("yres", "Y resolution"), 284: ("planar_conf", "Planar configuration"), 285: ("page_name", "Page name"), 286: ("xpos", "X position"), 287: ("ypos", "Y position"), 288: ("free_ofs", "Free offsets"), 289: ("free_byte", "Free byte counts"), 290: ("gray_resp_unit", "Gray response unit"), 291: ("gray_resp_curve", "Gray response curve"), 292: ("group3_opt", "Group 3 options"), 293: ("group4_opt", "Group 4 options"), 296: ("res_unit", "Resolution unit"), 297: ("page_nb", "Page number"), 301: ("color_respt_curve", "Color response curves"), 305: ("software", "Software"), 306: ("date_time", "Date time"), 315: ("artist", "Artist"), 316: ("host_computer", "Host computer"), 317: ("predicator", "Predicator"), 318: ("white_pt", "White point"), 319: ("prim_chomat", "Primary chromaticities"), 320: ("color_map", "Color map"), 321: ("half_tone_hints", "Halftone Hints"), 322: ("tile_width", "TileWidth"), 323: ("tile_length", "TileLength"), 324: ("tile_offsets", "TileOffsets"), 325: ("tile_byte_counts", "TileByteCounts"), 332: ("ink_set", "InkSet"), 333: ("ink_names", "InkNames"), 334: ("number_of_inks", "NumberOfInks"), 336: ("dot_range", "DotRange"), 337: ("target_printer", "TargetPrinter"), 338: ("extra_samples", "ExtraSamples"), 339: ("sample_format", "SampleFormat"), 340: ("smin_sample_value", "SMinSampleValue"), 341: ("smax_sample_value", "SMaxSampleValue"), 342: ("transfer_range", "TransferRange"), 512: ("jpeg_proc", "JPEGProc"), 513: ("jpeg_interchange_format", "JPEGInterchangeFormat"), 514: ("jpeg_interchange_format_length", "JPEGInterchangeFormatLength"), 515: ("jpeg_restart_interval", "JPEGRestartInterval"), 517: ("jpeg_lossless_predictors", "JPEGLosslessPredictors"), 518: ("jpeg_point_transforms", "JPEGPointTransforms"), 519: ("jpeg_qtables", "JPEGQTables"), 520: ("jpeg_dctables", "JPEGDCTables"), 521: ("jpeg_actables", "JPEGACTables"), 529: ("ycbcr_coefficients", "YCbCrCoefficients"), 530: ("ycbcr_subsampling", "YCbCrSubSampling"), 531: ("ycbcr_positioning", "YCbCrPositioning"), 532: ("reference_blackwhite", "ReferenceBlackWhite"), 33432: ("copyright", "Copyright"), 0x8769: ("ifd_pointer", "Pointer to next IFD entry"), } TAG_NAME = createDict(TAG_INFO, 0) def __init__(self, *args): FieldSet.__init__(self, *args) tag = self["tag"].value if tag in self.TAG_INFO: self._name, self._description = self.TAG_INFO[tag] else: self._parser = None class IFD(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) self._size = 16 + self["count"].value * IFDEntry.static_size self._has_offset = False def createFields(self): yield UInt16(self, "count") if MAX_COUNT < self["count"].value: raise ParserError("TIFF IFD: Invalid count (%s)" % self["count"].value) for index in xrange(self["count"].value): yield IFDEntry(self, "entry[]") class ImageFile(SeekableFieldSet): def __init__(self, parent, name, description, ifd): SeekableFieldSet.__init__(self, parent, name, description, None) self._has_offset = False self._ifd = ifd def createFields(self): datas = {} for entry in self._ifd: if type(entry) != IFDEntry: continue for c in entry: if c.name != "offset": continue self.seekByte(c.value, False) desc = "data of ifd entry " + entry.name, entryType = BasicIFDEntry.ENTRY_FORMAT[entry["type"].value] count = entry["count"].value if entryType == String: yield String(self, entry.name, count, desc, "\0", "ISO-8859-1") else: d = Data(self, entry.name, desc, entryType, count) datas[d.name] = d yield d break # image data if "strip_ofs" in datas and "strip_byte" in datas: for i in xrange(datas["strip_byte"]._count): self.seekByte(datas["strip_ofs"]["value["+str(i)+"]"].value, False) yield Bytes(self, "strip[]", datas["strip_byte"]["value["+str(i)+"]"].value) class Data(FieldSet): def __init__(self, parent, name, desc, type, count): size = type.static_size * count FieldSet.__init__(self, parent, name, desc, size) self._count = count self._type = type def createFields(self): for i in xrange(self._count): yield self._type(self, "value[]") class TiffFile(RootSeekableFieldSet, Parser): PARSER_TAGS = { "id": "tiff", "category": "image", "file_ext": ("tif", "tiff"), "mime": (u"image/tiff",), "min_size": 8*8, # TODO: Re-enable magic "magic": (("II\x2A\0", 0), ("MM\0\x2A", 0)), "description": "TIFF picture" } # Correct endian is set in constructor endian = LITTLE_ENDIAN def __init__(self, stream, **args): RootSeekableFieldSet.__init__(self, None, "root", stream, None, stream.askSize(self)) if self.stream.readBytes(0, 2) == "MM": self.endian = BIG_ENDIAN Parser.__init__(self, stream, **args) def validate(self): endian = self.stream.readBytes(0, 2) if endian not in ("MM", "II"): return "Invalid endian (%r)" % endian if self["version"].value != 42: return "Unknown TIFF version" return True def createFields(self): yield String(self, "endian", 2, 'Endian ("II" or "MM")', charset="ASCII") yield UInt16(self, "version", "TIFF version number") offset = UInt32(self, "img_dir_ofs[]", "Next image directory offset (in bytes from the beginning)") yield offset ifds = [] while True: if offset.value == 0: break self.seekByte(offset.value, relative=False) ifd = IFD(self, "ifd[]", "Image File Directory", None) ifds.append(ifd) yield ifd offset = UInt32(self, "img_dir_ofs[]", "Next image directory offset (in bytes from the beginning)") yield offset for ifd in ifds: image = ImageFile(self, "image[]", "Image File", ifd) yield image
8,387
Python
.py
192
34.395833
111
0.569349
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,663
png.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/png.pyc
Ñò Î ÈMc@s'dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZddklZddklZlZddklZddklZddklZd,Zy-dd klZd d-d „ƒYZ e!Z"Wne#j o e$Z"nXhdd6Z%hdd6Z&d.Z'd„Z(d„Z)d„Z*d„Z+d„Z,d„Z-d„Z.d„Z/d„Z0d„Z1d„Z2d„Z3d„Z4d„Z5d „Z6d!efd"„ƒYZ7d#„Z8d$„Z9d%„Z:d&efd'„ƒYZ;d(efd)„ƒYZ<d*S(/sq PNG picture file parser. Documents: - RFC 2083 http://www.faqs.org/rfcs/rfc2083.html Author: Victor Stinner iÿÿÿÿ(tParser(tFieldSettFragmentt ParserErrort MissingFieldtUInt8tUInt16tUInt32tStringtCStringtBytestRawBytestBittNullBitstEnumtCompressedField(tRGB(t textHandlert hexadecimal(tNETWORK_ENDIAN(t humanFilesize(tdatetimeiôi(t decompressobjtGunzipcBseZd„Zdd„ZRS(cCstƒ|_dS(N(Rtgzip(tselftstream((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt__init__scCs0|djo|ii}n|ii||ƒS(N(tNoneRtunconsumed_tailt decompress(Rtsizetdata((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt__call__"s N(t__name__t __module__RRR!(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyRs tMeteriudeflateiccs·t|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d ƒVt|d d ƒVt|d dƒVtt|ddƒtƒVt|ddƒVt|ddƒVdS(NtwidthsWidth (pixels)theightsHeight (pixels)t bit_depths Bit depthtreservedit has_alphasHas alpha channel?tcolors Color used?t has_palettesHas a color palette?t compressionsCompression methodtfilters Filter methodt interlacesInterlace method(RRR R RtCOMPRESSION_NAME(tparent((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt headerParse1scCs%d|di|dit|ƒfS(Ns&Header: %ux%u pixels and %u bits/pixelR%R&(tvaluetgetBitsPerPixel(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytheaderDescription=sccse|di}|ddjotd|ƒ‚n|d}x"t|ƒD]}t|dƒVqIWdS(NRiis.Palette have invalid size (%s), should be 3*n!scolor[](R2RtxrangeR(R0Rt nb_colorstindex((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt paletteParseAs   cCsd|didS(NsPalette: %u colorsRi(R2(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytpaletteDescriptionIsccst|ddƒVdS(NtgammasGamma (x10,000)(R(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt gammaParseLscCst|diƒdS(NR:i'(tfloatR2(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt gammaValueNscCs d|iS(Ns Gamma: %.3f(R2(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytgammaDescriptionPsccs\t|ddddƒV|di|did}|ot|d|dddƒVndS( NtkeywordtKeywordtcharsets ISO-8859-1RittexttText(R R2RR(R0tlength((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt textParseSscCs%d|jod|diSdSdS(NRBuText: %suText(tdisplay(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyttextDescriptionYs ccsjt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d ƒVt|d d ƒVdS( NtyeartYeartmonthtMonthtdaytDaythourtHourtminutetMinutetsecondtSecond(RR(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyttimestampParse_s cCsIt|di|di|di|di|di|diƒ}|S(NRHRJRLRNRPRR(RR2(R0R2((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyttimestampValuegs$ccs@t|ddƒVt|ddƒVtt|ddƒtƒVdS(Ntpixel_per_unit_xsPixel per unit, X axistpixel_per_unit_ysPixel per unit, Y axistunits Unit type(RRRt UNIT_NAME(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt physicalParsemscCsP|di}|di}d||f}|didjo|d7}n|S(NRVRWsPhysical: %ux%u pixelsRXis per meter(R2(R0txtytdesc((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytphysicalDescriptionrs   ccs.t|dƒVt|dƒVt|dƒVdS(Ntredtgreentblue(R(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytparseBackgroundColorzscCsS|di|di|dif}tii|ƒ}|pd|}nd|S(NR_R`Ras #%02X%02X%02XsBackground color: %s(R2Rt color_nametget(R0trgbtname((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytbackgroundColorDescs $t ImageDatacBseZdd„ZRS(tcompressed_datacsýti||ˆdd|diƒ|iidƒ}d|dt|dd ƒd}}|i|dƒ}||jo"d}tot |t ƒq©n |ˆ}y$|||‰‡‡fd†}Wnt j o d}nX|i ||ƒdS( NiRt[s ../%s[%%u]iiiÿÿÿÿcsˆˆS((((t_nextRf(sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt<lambda>•s( RRRR2RftsplittinttgetFieldt has_deflateRRRtsetLinks(RR0RfR tnexttfirst((RfRksB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyRˆs$'   (R"R#R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyRh‡sccst|dƒVdS(Nt color_index(R(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytparseTransparencyšscCsd|diS(NsTransparency: color #%uRt(R2(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyttextTransparency�scCs\d}|dio|d7}n|dio|di o|d7}n||diS(NiR)R*R+iR'(R2(theadert nr_component((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyR3 s tChunkcBsøeZh dedefd6deed"fd6deed"fd6de e d"fd6d e e e fd 6d eed"fd 6d eed"fd6deed"fd6dd„dd"fd6d#d6d$d6d%d6Zd„Zd"d„Zd „Zd!„ZRS(&ttimet TimestampttIMEtphysicaltpHYsRwtIHDRtpalettetPLTER:tgAMAstext[]ttEXtt transparencyttRNSt backgroundtbKGDsdata[]cCs t|ƒfS((Rh(R0((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyRl³ss Image datatIDATs utf8_text[]s%International text (encoded in UTF-8)tiTXts comp_text[]sCompressed texttzTXttendtEndtIENDcCs |i|ƒS(N(t value_func(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytcreateValueFunc¹scCsti||||ƒ|didd|_t|idjo!tdt|idƒƒ‚n|di}d|_d|_ ||i jot|i |\|_ |_ }}|o||_ |i |_n|o*t|tƒo ||_q||_qnd|_d|_ dS( NRiiisPNG: Chunk is too big (%s)ttagti (RRR2t_sizetMAX_CHUNK_SIZERRRt desc_funcRŽtTAG_INFOt_namet parse_funcR�t createValuet isinstancetstrt _description(RR0Rft descriptionR�R]RŽ((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyR¼s&      ccs¨t|ddƒVt|dddddƒV|di}|djoE|io#x4|i|ƒD] }|Vq_WqŠt|d |d ƒVntt|d d ƒtƒVdS( NRtSizeR�itTagRAtASCIIitcontenttDatatcrc32tCRC32(RRR2R—R RR(RRtfield((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt createFieldsÓs    cCs+|io|i|ƒSd|diSdS(Ns Chunk: %sR�(R”RF(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytcreateDescriptionàs N(s utf8_text[]Ns%International text (encoded in UTF-8)N(s comp_text[]NsCompressed textN(sendNsEndN(R"R#RTRURZR^RR1R4R8R9R;R>R=RERGRuRvRbRgR•R�RR¥R¦(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyRy¨s"    tPngFilecBsleZhdd6dd6dd6dd6dd 6dgd 6d d6ZeZd„Zd„Zd„Zd„ZRS(tpngtidtimagetcategorytfile_extu image/pngu image/x-pngtmimeitmin_sizes‰PNG  itmagics'Portable Network Graphics (PNG) pictureRœcCs6|didjodS|didjodStS(NR©s‰PNG  sInvalid signatureiRwsFirst chunk is not header(R2RftTrue(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytvalidateòs ccs8t|dddƒVx|ipt|dƒVqWdS(NR©is$PNG identifier ('\x89PNG\r\n\x1A\n')schunk[](R teofRy(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyR¥ùs cCsQ|d}d|di|dit|ƒf}|dio|d7}n|S(NRwsPNG picture: %ux%ux%uR%R&R)s (alpha layer)(R2R3(RRwR]((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyR¦þs  $cCsV|d}|i|i}td}|iid||ƒ}|dj o |dSdS(NRwit IEND®B`‚i i`(tabsolute_addressRt MAX_FILESIZERt searchBytesR(RR¤tstartR‹tpos((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pytcreateContentSizes    (R¨(u image/pngu image/x-pngi@(s‰PNG  i( R"R#t PARSER_TAGSRtendianR±R¥R¦R¹(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyR§æs     NiÐi@(iÐ(=t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R RRthachoir_parser.image.commonRthachoir_core.text_handlerRRthachoir_core.endianRthachoir_core.toolsRRRµtzlibRRR°Rpt ImportErrortFalseRYR/R“R1R4R8R9R;R=R>RERGRTRURZR^RbRgRhRuRvR3RyR§(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/png.pyt<module> sNd                     >
13,615
Python
.py
56
241.982143
1,287
0.452058
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,664
bmp.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/bmp.py
""" Microsoft Bitmap picture parser. - file extension: ".bmp" Author: Victor Stinner Creation: 16 december 2005 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt8, UInt16, UInt32, Bits, String, RawBytes, Enum, PaddingBytes, NullBytes, createPaddingField) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_parser.image.common import RGB, PaletteRGBA from hachoir_core.tools import alignValue class Pixel4bit(Bits): static_size = 4 def __init__(self, parent, name): Bits.__init__(self, parent, name, 4) class ImageLine(FieldSet): def __init__(self, parent, name, width, pixel_class): FieldSet.__init__(self, parent, name) self._pixel = pixel_class self._width = width self._size = alignValue(self._width * self._pixel.static_size, 32) def createFields(self): for x in xrange(self._width): yield self._pixel(self, "pixel[]") size = self.size - self.current_size if size: yield createPaddingField(self, size) class ImagePixels(FieldSet): def __init__(self, parent, name, width, height, pixel_class, size=None): FieldSet.__init__(self, parent, name, size=size) self._width = width self._height = height self._pixel = pixel_class def createFields(self): for y in xrange(self._height-1, -1, -1): yield ImageLine(self, "line[%u]" % y, self._width, self._pixel) size = (self.size - self.current_size) // 8 if size: yield NullBytes(self, "padding", size) class CIEXYZ(FieldSet): def createFields(self): yield UInt32(self, "x") yield UInt32(self, "y") yield UInt32(self, "z") class BmpHeader(FieldSet): color_space_name = { 1: "Business (Saturation)", 2: "Graphics (Relative)", 4: "Images (Perceptual)", 8: "Absolute colormetric (Absolute)", } def getFormatVersion(self): if "gamma_blue" in self: return 4 if "important_color" in self: return 3 return 2 def createFields(self): # Version 2 (12 bytes) yield UInt32(self, "header_size", "Header size") yield UInt32(self, "width", "Width (pixels)") yield UInt32(self, "height", "Height (pixels)") yield UInt16(self, "nb_plan", "Number of plan (=1)") yield UInt16(self, "bpp", "Bits per pixel") # may be zero for PNG/JPEG picture # Version 3 (40 bytes) if self["header_size"].value < 40: return yield Enum(UInt32(self, "compression", "Compression method"), BmpFile.COMPRESSION_NAME) yield UInt32(self, "image_size", "Image size (bytes)") yield UInt32(self, "horizontal_dpi", "Horizontal DPI") yield UInt32(self, "vertical_dpi", "Vertical DPI") yield UInt32(self, "used_colors", "Number of color used") yield UInt32(self, "important_color", "Number of import colors") # Version 4 (108 bytes) if self["header_size"].value < 108: return yield textHandler(UInt32(self, "red_mask"), hexadecimal) yield textHandler(UInt32(self, "green_mask"), hexadecimal) yield textHandler(UInt32(self, "blue_mask"), hexadecimal) yield textHandler(UInt32(self, "alpha_mask"), hexadecimal) yield Enum(UInt32(self, "color_space"), self.color_space_name) yield CIEXYZ(self, "red_primary") yield CIEXYZ(self, "green_primary") yield CIEXYZ(self, "blue_primary") yield UInt32(self, "gamma_red") yield UInt32(self, "gamma_green") yield UInt32(self, "gamma_blue") def parseImageData(parent, name, size, header): if ("compression" not in header) or (header["compression"].value in (0, 3)): width = header["width"].value height = header["height"].value bpp = header["bpp"].value if bpp == 32: cls = UInt32 elif bpp == 24: cls = RGB elif bpp == 8: cls = UInt8 elif bpp == 4: cls = Pixel4bit else: cls = None if cls: return ImagePixels(parent, name, width, height, cls, size=size*8) return RawBytes(parent, name, size) class BmpFile(Parser): PARSER_TAGS = { "id": "bmp", "category": "image", "file_ext": ("bmp",), "mime": (u"image/x-ms-bmp", u"image/x-bmp"), "min_size": 30*8, # "magic": (("BM", 0),), "magic_regex": (( # "BM", <filesize>, <reserved>, header_size=(12|40|108) "BM.{4}.{8}[\x0C\x28\x6C]\0{3}", 0),), "description": "Microsoft bitmap (BMP) picture" } endian = LITTLE_ENDIAN COMPRESSION_NAME = { 0: u"Uncompressed", 1: u"RLE 8-bit", 2: u"RLE 4-bit", 3: u"Bitfields", 4: u"JPEG", 5: u"PNG", } def validate(self): if self.stream.readBytes(0, 2) != 'BM': return "Wrong file signature" if self["header/header_size"].value not in (12, 40, 108): return "Unknown header size (%s)" % self["header_size"].value if self["header/nb_plan"].value != 1: return "Invalid number of planes" return True def createFields(self): yield String(self, "signature", 2, "Header (\"BM\")", charset="ASCII") yield UInt32(self, "file_size", "File size (bytes)") yield PaddingBytes(self, "reserved", 4, "Reserved") yield UInt32(self, "data_start", "Data start position") yield BmpHeader(self, "header") # Compute number of color header = self["header"] bpp = header["bpp"].value if 0 < bpp <= 8: if "used_colors" in header and header["used_colors"].value: nb_color = header["used_colors"].value else: nb_color = (1 << bpp) else: nb_color = 0 # Color palette (if any) if nb_color: yield PaletteRGBA(self, "palette", nb_color) # Seek to data start field = self.seekByte(self["data_start"].value) if field: yield field # Image pixels size = min(self["file_size"].value-self["data_start"].value, (self.size - self.current_size)//8) yield parseImageData(self, "pixels", size, header) def createDescription(self): return u"Microsoft Bitmap version %s" % self["header"].getFormatVersion() def createContentSize(self): return self["file_size"].value * 8
6,682
Python
.py
170
31.029412
104
0.595345
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,665
xcf.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/xcf.py
""" Gimp image parser (XCF file, ".xcf" extension). You can find informations about XCF file in Gimp source code. URL to read CVS online: http://cvs.gnome.org/viewcvs/gimp/app/xcf/ \--> files xcf-read.c and xcf-load.c Author: Victor Stinner """ from hachoir_parser import Parser from hachoir_core.field import (StaticFieldSet, FieldSet, ParserError, UInt8, UInt32, Enum, Float32, String, PascalString32, RawBytes) from hachoir_parser.image.common import RGBA from hachoir_core.endian import NETWORK_ENDIAN class XcfCompression(FieldSet): static_size = 8 COMPRESSION_NAME = { 0: u"None", 1: u"RLE", 2: u"Zlib", 3: u"Fractal" } def createFields(self): yield Enum(UInt8(self, "compression", "Compression method"), self.COMPRESSION_NAME) class XcfResolution(StaticFieldSet): format = ( (Float32, "xres", "X resolution in DPI"), (Float32, "yres", "Y resolution in DPI") ) class XcfTattoo(StaticFieldSet): format = ((UInt32, "tattoo", "Tattoo"),) class LayerOffsets(StaticFieldSet): format = ( (UInt32, "ofst_x", "Offset X"), (UInt32, "ofst_y", "Offset Y") ) class LayerMode(FieldSet): static_size = 32 MODE_NAME = { 0: u"Normal", 1: u"Dissolve", 2: u"Behind", 3: u"Multiply", 4: u"Screen", 5: u"Overlay", 6: u"Difference", 7: u"Addition", 8: u"Subtract", 9: u"Darken only", 10: u"Lighten only", 11: u"Hue", 12: u"Saturation", 13: u"Color", 14: u"Value", 15: u"Divide", 16: u"Dodge", 17: u"Burn", 18: u"Hard light", 19: u"Soft light", 20: u"Grain extract", 21: u"Grain merge", 22: u"Color erase" } def createFields(self): yield Enum(UInt32(self, "mode", "Layer mode"), self.MODE_NAME) class GimpBoolean(UInt32): def __init__(self, parent, name): UInt32.__init__(self, parent, name) def createValue(self): return 1 == UInt32.createValue(self) class XcfUnit(StaticFieldSet): format = ((UInt32, "unit", "Unit"),) class XcfParasiteEntry(FieldSet): def createFields(self): yield PascalString32(self, "name", "Name", strip="\0", charset="UTF-8") yield UInt32(self, "flags", "Flags") yield PascalString32(self, "data", "Data", strip=" \0", charset="UTF-8") class XcfLevel(FieldSet): def createFields(self): yield UInt32(self, "width", "Width in pixel") yield UInt32(self, "height", "Height in pixel") yield UInt32(self, "offset", "Offset") offset = self["offset"].value if offset == 0: return data_offsets = [] while (self.absolute_address + self.current_size)/8 < offset: chunk = UInt32(self, "data_offset[]", "Data offset") yield chunk if chunk.value == 0: break data_offsets.append(chunk) if (self.absolute_address + self.current_size)/8 != offset: raise ParserError("Problem with level offset.") previous = offset for chunk in data_offsets: data_offset = chunk.value size = data_offset - previous yield RawBytes(self, "data[]", size, "Data content of %s" % chunk.name) previous = data_offset class XcfHierarchy(FieldSet): def createFields(self): yield UInt32(self, "width", "Width") yield UInt32(self, "height", "Height") yield UInt32(self, "bpp", "Bits/pixel") offsets = [] while True: chunk = UInt32(self, "offset[]", "Level offset") yield chunk if chunk.value == 0: break offsets.append(chunk.value) for offset in offsets: padding = self.seekByte(offset, relative=False) if padding is not None: yield padding yield XcfLevel(self, "level[]", "Level") # yield XcfChannel(self, "channel[]", "Channel")) class XcfChannel(FieldSet): def createFields(self): yield UInt32(self, "width", "Channel width") yield UInt32(self, "height", "Channel height") yield PascalString32(self, "name", "Channel name", strip="\0", charset="UTF-8") for field in readProperties(self): yield field yield UInt32(self, "hierarchy_ofs", "Hierarchy offset") yield XcfHierarchy(self, "hierarchy", "Hierarchy") def createDescription(self): return 'Channel "%s"' % self["name"].value class XcfLayer(FieldSet): def createFields(self): yield UInt32(self, "width", "Layer width in pixels") yield UInt32(self, "height", "Layer height in pixels") yield Enum(UInt32(self, "type", "Layer type"), XcfFile.IMAGE_TYPE_NAME) yield PascalString32(self, "name", "Layer name", strip="\0", charset="UTF-8") for prop in readProperties(self): yield prop # -- # TODO: Hack for Gimp 1.2 files # -- yield UInt32(self, "hierarchy_ofs", "Hierarchy offset") yield UInt32(self, "mask_ofs", "Layer mask offset") padding = self.seekByte(self["hierarchy_ofs"].value, relative=False) if padding is not None: yield padding yield XcfHierarchy(self, "hierarchy", "Hierarchy") # TODO: Read layer mask if needed: self["mask_ofs"].value != 0 def createDescription(self): return 'Layer "%s"' % self["name"].value class XcfParasites(FieldSet): def createFields(self): size = self["../size"].value * 8 while self.current_size < size: yield XcfParasiteEntry(self, "parasite[]", "Parasite") class XcfProperty(FieldSet): PROP_COMPRESSION = 17 PROP_RESOLUTION = 19 PROP_PARASITES = 21 TYPE_NAME = { 0: u"End", 1: u"Colormap", 2: u"Active layer", 3: u"Active channel", 4: u"Selection", 5: u"Floating selection", 6: u"Opacity", 7: u"Mode", 8: u"Visible", 9: u"Linked", 10: u"Lock alpha", 11: u"Apply mask", 12: u"Edit mask", 13: u"Show mask", 14: u"Show masked", 15: u"Offsets", 16: u"Color", 17: u"Compression", 18: u"Guides", 19: u"Resolution", 20: u"Tattoo", 21: u"Parasites", 22: u"Unit", 23: u"Paths", 24: u"User unit", 25: u"Vectors", 26: u"Text layer flags", } handler = { 6: RGBA, 7: LayerMode, 8: GimpBoolean, 9: GimpBoolean, 10: GimpBoolean, 11: GimpBoolean, 12: GimpBoolean, 13: GimpBoolean, 15: LayerOffsets, 17: XcfCompression, 19: XcfResolution, 20: XcfTattoo, 21: XcfParasites, 22: XcfUnit } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = (8 + self["size"].value) * 8 def createFields(self): yield Enum(UInt32(self, "type", "Property type"), self.TYPE_NAME) yield UInt32(self, "size", "Property size") size = self["size"].value if 0 < size: cls = self.handler.get(self["type"].value, None) if cls: yield cls(self, "data", size=size*8) else: yield RawBytes(self, "data", size, "Data") def createDescription(self): return "Property: %s" % self["type"].display def readProperties(parser): while True: prop = XcfProperty(parser, "property[]") yield prop if prop["type"].value == 0: return class XcfFile(Parser): PARSER_TAGS = { "id": "xcf", "category": "image", "file_ext": ("xcf",), "mime": (u"image/x-xcf", u"application/x-gimp-image"), "min_size": (26 + 8 + 4 + 4)*8, # header+empty property+layer offset+channel offset "magic": ( ('gimp xcf file\0', 0), ('gimp xcf v002\0', 0), ), "description": "Gimp (XCF) picture" } endian = NETWORK_ENDIAN IMAGE_TYPE_NAME = { 0: u"RGB", 1: u"Gray", 2: u"Indexed" } def validate(self): if self.stream.readBytes(0, 14) not in ('gimp xcf file\0', 'gimp xcf v002\0'): return "Wrong signature" return True def createFields(self): # Read signature yield String(self, "signature", 14, "Gimp picture signature (ends with nul byte)", charset="ASCII") # Read image general informations (width, height, type) yield UInt32(self, "width", "Image width") yield UInt32(self, "height", "Image height") yield Enum(UInt32(self, "type", "Image type"), self.IMAGE_TYPE_NAME) for prop in readProperties(self): yield prop # Read layer offsets layer_offsets = [] while True: chunk = UInt32(self, "layer_offset[]", "Layer offset") yield chunk if chunk.value == 0: break layer_offsets.append(chunk.value) # Read channel offsets channel_offsets = [] while True: chunk = UInt32(self, "channel_offset[]", "Channel offset") yield chunk if chunk.value == 0: break channel_offsets.append(chunk.value) # Read layers for index, offset in enumerate(layer_offsets): if index+1 < len(layer_offsets): size = (layer_offsets[index+1] - offset) * 8 else: size = None padding = self.seekByte(offset, relative=False) if padding: yield padding yield XcfLayer(self, "layer[]", size=size) # Read channels for index, offset in enumerate(channel_offsets): if index+1 < len(channel_offsets): size = (channel_offsets[index+1] - offset) * 8 else: size = None padding = self.seekByte(offset, relative=False) if padding is not None: yield padding yield XcfChannel(self, "channel[]", "Channel", size=size)
10,353
Python
.py
291
26.725086
108
0.568649
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,666
pcx.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/pcx.pyc
Ñò Î ÈMc@sxdZddklZddklZlZlZlZlZddk l Z ddk l Z defd„ƒYZ dS( s PCX picture filter. iÿÿÿÿ(tParser(tUInt8tUInt16t PaddingBytestRawBytestEnum(t PaletteRGB(t LITTLE_ENDIANtPcxFilecBs†eZeZhdd6dd6dd6dd6dd 6d d 6Zhd d 6Zhdd6dd6dd6dd6dd6Zd„Zd„ZRS(tpcxtidtimagetcategorytfile_extu image/x-pcxtmimei€itmin_sizesPC Paintbrush (PCX) picturet descriptionsRun-length encoding (RLE)iuVersion 2.5 of PC Paintbrushiu$Version 2.8 with palette informationiu'Version 2.8 without palette informationiuPC Paintbrush for Windowsiu)Version 3.0 (or greater) of PC PaintbrushicCsk|didjodS|di|ijodS|didjod S|didjodStS(NR i sWrong signaturetversionsUnknown format versiontbppiiiiii sUnknown bits/pixels reserved[0]tsInvalid reserved value(iiiiii (tvaluet version_nametTrue(tself((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/pcx.pytvalidate sccsÂt|ddƒVtt|ddƒ|iƒVtt|ddƒ|iƒVt|ddƒVt|d d ƒVt|d d ƒVt|d dƒVt|ddƒVt|ddƒVt|ddƒVt|dddƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|dd ƒV|idjo t ‚nd!}|i|i d"}|di d"j}|o||d#8}nt |d$|d%ƒV|ot|d&|d'ƒVndS((NR sPCX identifier (10)Rs PCX versiont compressionsCompression methodRs Bits / pixeltxmins Minimum Xtymins Minimum YtxmaxsWidth minus onetymaxsHeight minus onet horiz_dpisHorizontal DPItvert_dpis Vertical DPIt palette_4bitsisPalette (4 bits)s reserved[]it nb_color_plansNumber of color planstbytes_per_linesBytes per linet color_modes Color modei:iiit image_datas Image datat palette_8bitssPalette (8 bit)( RRRtcompression_nameRRRt_sizetNonetNotImplementedErrort current_sizeRR(Rt nb_colorstsizet has_palette((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/pcx.pyt createFields+s4 (R (u image/x-pcxi( t__name__t __module__Rtendiant PARSER_TAGSR&RRR.(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/pcx.pyR s"    N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRthachoir_parser.image.commonRthachoir_core.endianRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/pcx.pyt<module>s (
3,298
Python
.py
24
136.416667
624
0.490382
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,667
pcx.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/pcx.py
""" PCX picture filter. """ from hachoir_parser import Parser from hachoir_core.field import ( UInt8, UInt16, PaddingBytes, RawBytes, Enum) from hachoir_parser.image.common import PaletteRGB from hachoir_core.endian import LITTLE_ENDIAN class PcxFile(Parser): endian = LITTLE_ENDIAN PARSER_TAGS = { "id": "pcx", "category": "image", "file_ext": ("pcx",), "mime": (u"image/x-pcx",), "min_size": 128*8, "description": "PC Paintbrush (PCX) picture" } compression_name = { 1: "Run-length encoding (RLE)" } version_name = { 0: u"Version 2.5 of PC Paintbrush", 2: u"Version 2.8 with palette information", 3: u"Version 2.8 without palette information", 4: u"PC Paintbrush for Windows", 5: u"Version 3.0 (or greater) of PC Paintbrush" } def validate(self): if self["id"].value != 10: return "Wrong signature" if self["version"].value not in self.version_name: return "Unknown format version" if self["bpp"].value not in (1, 2, 4, 8, 24, 32): return "Unknown bits/pixel" if self["reserved[0]"].value != "\0": return "Invalid reserved value" return True def createFields(self): yield UInt8(self, "id", "PCX identifier (10)") yield Enum(UInt8(self, "version", "PCX version"), self.version_name) yield Enum(UInt8(self, "compression", "Compression method"), self.compression_name) yield UInt8(self, "bpp", "Bits / pixel") yield UInt16(self, "xmin", "Minimum X") yield UInt16(self, "ymin", "Minimum Y") yield UInt16(self, "xmax", "Width minus one") # value + 1 yield UInt16(self, "ymax", "Height minus one") # value + 1 yield UInt16(self, "horiz_dpi", "Horizontal DPI") yield UInt16(self, "vert_dpi", "Vertical DPI") yield PaletteRGB(self, "palette_4bits", 16, "Palette (4 bits)") yield PaddingBytes(self, "reserved[]", 1) yield UInt8(self, "nb_color_plan", "Number of color plans") yield UInt16(self, "bytes_per_line", "Bytes per line") yield UInt16(self, "color_mode", "Color mode") yield PaddingBytes(self, "reserved[]", 58) if self._size is None: # TODO: is it possible to handle piped input? raise NotImplementedError nb_colors = 256 size = (self._size - self.current_size)/8 has_palette = self["bpp"].value == 8 if has_palette: size -= nb_colors*3 yield RawBytes(self, "image_data", size, "Image data") if has_palette: yield PaletteRGB(self, "palette_8bits", nb_colors, "Palette (8 bit)")
2,729
Python
.py
65
34.092308
91
0.607681
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,668
common.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/common.py
from hachoir_core.field import FieldSet, UserVector, UInt8 class RGB(FieldSet): color_name = { ( 0, 0, 0): "Black", (255, 0, 0): "Red", ( 0, 255, 0): "Green", ( 0, 0, 255): "Blue", (255, 255, 255): "White", } static_size = 24 def createFields(self): yield UInt8(self, "red", "Red") yield UInt8(self, "green", "Green") yield UInt8(self, "blue", "Blue") def createDescription(self): rgb = self["red"].value, self["green"].value, self["blue"].value name = self.color_name.get(rgb) if not name: name = "#%02X%02X%02X" % rgb return "RGB color: " + name class RGBA(RGB): static_size = 32 def createFields(self): yield UInt8(self, "red", "Red") yield UInt8(self, "green", "Green") yield UInt8(self, "blue", "Blue") yield UInt8(self, "alpha", "Alpha") def createDescription(self): description = RGB.createDescription(self) opacity = self["alpha"].value*100/255 return "%s (opacity: %s%%)" % (description, opacity) class PaletteRGB(UserVector): item_class = RGB item_name = "color" def createDescription(self): return "Palette of %u RGB colors" % len(self) class PaletteRGBA(PaletteRGB): item_class = RGBA def createDescription(self): return "Palette of %u RGBA colors" % len(self)
1,429
Python
.py
40
28.7
72
0.584058
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,669
xcf.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/xcf.pyc
Ñò Î ÈMc@sÓdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z ddklZddklZdefd„ƒYZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd efd!„ƒYZd"„Z d#efd$„ƒYZ!d%S(&sô Gimp image parser (XCF file, ".xcf" extension). You can find informations about XCF file in Gimp source code. URL to read CVS online: http://cvs.gnome.org/viewcvs/gimp/app/xcf/ \--> files xcf-read.c and xcf-load.c Author: Victor Stinner iÿÿÿÿ(tParser( tStaticFieldSettFieldSett ParserErrortUInt8tUInt32tEnumtFloat32tStringtPascalString32tRawBytes(tRGBA(tNETWORK_ENDIANtXcfCompressioncBs9eZdZhdd6dd6dd6dd6Zd „ZRS( iuNoneiuRLEiuZlibiuFractaliccs!tt|ddƒ|iƒVdS(Nt compressionsCompression method(RRtCOMPRESSION_NAME(tself((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyt createFieldss(t__name__t __module__t static_sizeRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR s t XcfResolutioncBs&eZeddfeddffZRS(txressX resolution in DPItyressY resolution in DPI(RRRtformat(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRs t XcfTattoocBseZeddffZRS(ttattootTattoo(RRRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR$st LayerOffsetscBs&eZeddfeddffZRS(tofst_xsOffset Xtofst_ysOffset Y(RRRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR's t LayerModecBs¾eZdZhdd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6Zd/„ZRS(0i uNormaliuDissolveiuBehindiuMultiplyiuScreeniuOverlayiu DifferenceiuAdditioniuSubtractiu Darken onlyi u Lighten onlyi uHuei u Saturationi uColori uValueiuDivideiuDodgeiuBurniu Hard lightiu Soft lightiu Grain extractiu Grain mergeiu Color eraseiccs!tt|ddƒ|iƒVdS(Ntmodes Layer mode(RRt MODE_NAME(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRIs(RRRR!R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR-s4 t GimpBooleancBseZd„Zd„ZRS(cCsti|||ƒdS(N(Rt__init__(Rtparenttname((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR#MscCsdti|ƒjS(Ni(Rt createValue(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR&Ps(RRR#R&(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR"Ls tXcfUnitcBseZeddffZRS(tunittUnit(RRRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR'SstXcfParasiteEntrycBseZd„ZRS(ccsOt|ddddddƒVt|ddƒVt|d d dd ddƒVdS( NR%tNametstripttcharsetsUTF-8tflagstFlagstdatatDatas (R R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRWs(RRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR*VstXcfLevelcBseZd„ZRS(ccs.t|ddƒVt|ddƒVt|ddƒV|di}|djodSg}xY|i|id|jo=t|d d ƒ}|V|idjoPn|i|ƒq[W|i|id|jotd ƒ‚n|}xB|D]:}|i}||}t|d |d |iƒV|}qìWdS(NtwidthsWidth in pixeltheightsHeight in pixeltoffsettOffsetiis data_offset[]s Data offsetsProblem with level offset.sdata[]sData content of %s(Rtvaluetabsolute_addresst current_sizetappendRR R%(RR6t data_offsetstchunktprevioust data_offsettsize((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR]s.    (RRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR3\st XcfHierarchycBseZd„ZRS(ccsÕt|ddƒVt|ddƒVt|ddƒVg}xHto@t|ddƒ}|V|id joPn|i|iƒq<WxJ|D]B}|i|d tƒ}|dj o |Vnt|d d ƒVq‹WdS( NR4tWidthR5tHeighttbpps Bits/pixelsoffset[]s Level offsetitrelativeslevel[]tLevel(RtTrueR8R;tseekBytetFalsetNoneR3(RtoffsetsR=R6tpadding((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRus"  (RRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRAtst XcfChannelcBseZd„Zd„ZRS(ccs�t|ddƒVt|ddƒVt|ddddd d ƒVxt|ƒD] }|VqLWt|d d ƒVt|d dƒVdS(NR4s Channel widthR5sChannel heightR%s Channel nameR,R-R.sUTF-8t hierarchy_ofssHierarchy offsett hierarchyt Hierarchy(RR treadPropertiesRA(Rtfield((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR‰s  cCsd|diS(Ns Channel "%s"R%(R8(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pytcreateDescription’s(RRRRS(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRMˆs tXcfLayercBseZd„Zd„ZRS(ccsát|ddƒVt|ddƒVtt|ddƒtiƒVt|ddd d d d ƒVxt|ƒD] }|VqiWt|d dƒVt|ddƒV|i|d idtƒ}|dj o |Vnt |ddƒVdS(NR4sLayer width in pixelsR5sLayer height in pixelsttypes Layer typeR%s Layer nameR,R-R.sUTF-8RNsHierarchy offsettmask_ofssLayer mask offsetRERORP( RRtXcfFiletIMAGE_TYPE_NAMER RQRHR8RIRJRA(RtpropRL((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR–s    cCsd|diS(Ns Layer "%s"R%(R8(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRSªs(RRRRS(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRT•s t XcfParasitescBseZd„ZRS(ccs>|did}x&|i|jot|ddƒVqWdS(Ns../sizeis parasite[]tParasite(R8R:R*(RR@((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR®s(RRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRZ­st XcfPropertycBs`eZdZdZdZhdd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d6d&d'6d(d6d)d*6d+d6d,d-6d.d/6d0d16d2d36d4d56Zhed6ed6ed6ed6ed6ed6ed6ed6e d"6e d6e d6e d*6e d6ed-6Zd6„Zd7„Zd8„ZRS(9iiiuEndiuColormapiu Active layeriuActive channeliu SelectioniuFloating selectioniuOpacityiuModeiuVisibleiuLinkedi u Lock alphai u Apply maski u Edit maski u Show maski u Show maskediuOffsetsiuColoriu CompressionuGuidesiu ResolutionuTattooiu ParasitesuUnitiuPathsiu User unitiuVectorsiuText layer flagsicOs/ti|||Žd|did|_dS(NiR@(RR#R8t_size(Rtargstkw((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR#æsccs£tt|ddƒ|iƒVt|ddƒV|di}d|joW|ii|didƒ}|o||dd|dƒVqŸt|d|dƒVndS( NRUs Property typeR@s Property sizeiR1iR2(RRt TYPE_NAMER8thandlertgetRJR (RR@tcls((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRês  cCsd|diS(Ns Property: %sRU(tdisplay(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRSös(RRtPROP_COMPRESSIONtPROP_RESOLUTIONtPROP_PARASITESR`R RR"RR RRRZR'RaR#RRS(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyR\³sb    ccs@x9to1t|dƒ}|V|didjodSqWdS(Ns property[]RUi(RGR\R8(tparserRY((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRQùs RWcBsxeZhdd6dd6dd6dd6dd 6dd fd6dd6ZeZhdd 6dd6dd6Zd„Zd„ZRS(!txcftidtimagetcategorytfile_extu image/x-xcfuapplication/x-gimp-imagetmimeiiitmin_sizesgimp xcf fileisgimp xcf v002tmagicsGimp (XCF) picturet descriptionuRGBuGrayiuIndexedicCs%|iiddƒdjodStS(Niisgimp xcf filesgimp xcf v002sWrong signature(sgimp xcf filesgimp xcf v002(tstreamt readBytesRG(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pytvalidatesc cs>t|dddddƒVt|ddƒVt|dd ƒVtt|d d ƒ|iƒVxt|ƒD] }|VqfWg}xHto@t|d d ƒ}|V|idjoPn|i|iƒq~Wg}xHto@t|ddƒ}|V|idjoPn|i|iƒqÏWxŠt|ƒD]|\}}|dt |ƒjo||d|d}nd}|i |dt ƒ}|o |Vnt |dd|ƒVq$Wx“t|ƒD]…\}}|dt |ƒjo||d|d}nd}|i |dt ƒ}|dj o |Vnt|ddd|ƒVq±WdS(Nt signatureis+Gimp picture signature (ends with nul byte)R.tASCIIR4s Image widthR5s Image heightRUs Image typeslayer_offset[]s Layer offsetischannel_offset[]sChannel offsetiiREslayer[]R@s channel[]tChannel(RRRRXRQRGR8R;t enumeratetlenRJRHRIRTRM( RRYt layer_offsetsR=tchannel_offsetstindexR6R@RL((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRsR       (Ri(u image/x-xcfuapplication/x-gimp-imagei"i&i*iP(sgimp xcf filei(sgimp xcf v002i(RRt PARSER_TAGSR tendianRXRtR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyRWs     N("t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R thachoir_parser.image.commonR thachoir_core.endianR R RRRRR"R'R*R3RARMRTRZR\RQRW(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/image/xcf.pyt<module> s(F  F 
13,977
Python
.py
55
253.018182
1,009
0.450902
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,670
exif.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/exif.pyc
—Ú Œ »Mc@s2dZddklZlZlZlZlZlZlZl Z l Z l Z l Z l Z ddklZlZlZddklZlZddklZdZdÑZedd eÉZed d eÉZd efd ÑÉYZd efdÑÉYZdÑZdefdÑÉYZdefdÑÉYZdS(s[ EXIF metadata parser (can be found in a JPEG picture for example) Author: Victor Stinner iˇˇˇˇ( tFieldSett ParserErrortUInt8tUInt16tUInt32tInt32tEnumtStringtBytestSubFilet NullBytestcreatePaddingField(t LITTLE_ENDIANt BIG_ENDIANtNETWORK_ENDIAN(t textHandlert hexadecimal(t createDictiËcs2dtfááfdÜÉY}|}||_|S(NtRationalcs&eZàZáfdÜZdÑZRS(c3s à|dÉVà|dÉVdS(Nt numeratort denominator((tself(t field_class(sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyt createFieldsscSst|diÉ|diS(NRR(tfloattvalue(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyt createValues(t__name__t __module__t static_sizeRR((Rtsize(sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRs(RR(t class_nameRRRtcls((RRsC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pytrationalFactorys  t RationalInt32i@tRationalUInt32t BasicIFDEntrycBsæeZdZdZdZdZhedfd6edfd6edfd 6e d fd 6e d fd6e d fd6e dfd6e dfd6ZeedÉZeedÉZdÑZdÑZRS(iiii s BYTE (8 bits)isASCII (8 bits)isSHORT (16 bits)isLONG (32 bits)isRATIONAL (2x LONG, 64 bits)sUNDEFINED (8 bits)sSIGNED LONG (32 bits)i s$SRATIONAL (2x SIGNED LONGs, 64 bits)c csˆttt|ddÉtÉ|iÉVttt|ddÉtÉ|iÉVt|ddÉV|di|i|i fjo/t |dijot d|diÉÇn|i É\}}|pt |dd ÉVn|d jo˙d |jo d }nd }h}|i}|tjo.|||ddf}d|d<d|d<n7|tjo|||ddf}n||df}x"t|ÉD]}|||éVqëW||}|d jot |dd |dÉVqÚnt|ddÉVdS(NttagtTagttypetTypetcounttCountsEXIF: Invalid count value (%s)tpaddingii isvalue[]RitValues tstrips ISO-8859-1tcharsettoffsets Value offset(RRRRtTAG_NAMEt TYPE_NAMERRt TYPE_BYTEtTYPE_UNDEFINEDt MAX_COUNTRtgetSizesR t value_clsRRtxrange( Rt value_sizet array_sizetnametkwR targstindexR((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyR5s:&&           !cCsi|ii|ditÉ|_|di}|ittfjod|dfS|ii||fSdS(sq Returns (value_size, array_size): value_size in bits and array_size in number of items. R'R)iiN(t ENTRY_FORMATtgetRRR6RR(RR)((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyR5Ys  (RRR2R3t TYPE_RATIONALtTYPE_SIGNED_RATIONALRRRRR#RRR"t TYPE_INFORR>R1RR5(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyR$#s"        $t ExifEntrycBs∆eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZhsdd6dd6dd6dd6dd6dd6dd 6dd 6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJd 6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWe6dXdY6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dld6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dye6dze6d{e6d|e6d}e6dyd~6ddÄ6dÅd6dÇe6dÉe6dÑdÖ6dÜdá6dàdâ6dädã6dådç6dédè6dêe6dëdí6dìe6dîdï6dñdó6dòdô6dödõ6dúdù6dûdü6d†d°6d¢d£6d§d•6d¶dß6d®d©6d™d´6d¨d≠6dÆdØ6d∞d±6d≤d≥6d¥dµ6d∂d∑6d∏dπ6d∫dª6dºdΩ6dædø6d¿d¡6d¬d√6dƒd≈6d∆d«6d»d…6d dÀ6dÃdÕ6dŒdœ6d–e6d—e6d“d”6d‘e6d’d÷6d◊dÿ6dŸd⁄6d€d‹6d›dfi6dfld‡6d·d‚6d„d‰6ZdÂÑZRS(Êiiiái†i†iiiiiiiiii2i1iiiiöÇiùÇiíiíiÜísGPS version IDisGPS latitude refs GPS latitudesGPS longitude refs GPS longitudesGPS altitude refs GPS altitudes GPS timestampsGPS satellitesis GPS statusi sGPS measure modei sGPS DOPi s GPS speed refi s GPS speedi s GPS track refis GPS trackisGPS img direction refisGPS img directionis GPS map datumisGPS dest latitude refisGPS dest latitudeisGPS dest longitude refisGPS dest longitudeisGPS dest bearing refisGPS dest bearingisGPS dest distance refisGPS dest distanceisGPS processing methodisGPS area informationis GPS datestampsGPS differentialis Image widthis Image heightisNumber of bits per componentisCompression schemeisPixel compositionisOrientation of imagesNumber of componentsisImage data arrangementisSubsampling ratio Y to CisY and C positioningis Image resolution width directionis$Image resolution in height directionisUnit of X and Y resolutioni(sImage data locationisNumber of rows per stripisBytes per compressed stripisOffset to JPEG SOIsBytes of JPEG dataisTransfer functioni-sWhite point chromaticityi>sChromaticities of primariesi?s.Color space transformation matrix coefficientsis(Pair of blank and white reference valuesisFile change date and times Image titles+Camera (Image input equipment) manufacturers$Camera (Input input equipment) modeltSoftwarei;sCopyright holderiòÇsExif IFD Pointers Exposure timesF numbersExposure programi"àsSpectral sensitivityi$àsISO speed ratingi'às#Optoelectric conversion factor OECFi(às Shutter speediítApertureiít Brightnesss Exposure biasiísMaximum lens aperturesSubject distanceiís Metering modeiís Light sourceiítFlashi ísLens focal lengthi ís Subject areaiís Flash energyi ¢sSpatial frequency responsei ¢sFocal plane X resolutioni¢sFocal plane Y resolutioni¢sFocal plane resolution uniti¢sSubject locationi¢sExposure indexi¢sSensing methodi¢s File sourcei£s Scene typei£s CFA patterni£sCustom image processingi§s Exposure modei§s White balancei§sDigital zoom ratioi§sFocal length in 35 mm filmi§sScene capture typei§s Gain controli§tContrasti§s Exif versioniêsSupported Flashpix versioni†sColor space informationi†sMeaning of each componentiësImage compression modeiësValid image widthsValid image heightsManufacturer notesi|ís User commentssRelated audio filei†s)Date and time of original data generationiês(Date and time of digital data generationiêsDateTime subsecondsiêísDateTimeOriginal subsecondsiëísDateTimeDigitized subsecondsiíísUnique image IDi §sInteroperability IFD Pointeri†cCsd|diS(Ns Entry: %sR%(tdisplay(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pytcreateDescriptions(RRtOFFSET_JPEG_SOItEXIF_IFD_POINTERt TAG_WIDTHt TAG_HEIGHTtTAG_GPS_LATITUDE_REFtTAG_GPS_LATITUDEtTAG_GPS_LONGITUDE_REFtTAG_GPS_LONGITUDEtTAG_GPS_ALTITUDE_REFtTAG_GPS_ALTITUDEtTAG_GPS_TIMESTAMPtTAG_GPS_DATESTAMPt TAG_IMG_TITLEtTAG_FILE_TIMESTAMPt TAG_SOFTWAREtTAG_CAMERA_MODELtTAG_CAMERA_MANUFACTURERtTAG_ORIENTATIONt TAG_EXPOSUREt TAG_FOCALtTAG_BRIGHTNESSt TAG_APERTUREtTAG_USER_COMMENTR0RJ(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRChs cCst|di|diÉS(NR/(tintR(tatb((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyt sortExifEntrystExifIFDcBs#eZdÑZdÑZdÑZRS(cCs?||i|id}d|jot||dÉSdSdS(sB Seek to byte address relative to parent address. iiN(taddresst current_sizeR tNone(RR/R+((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pytseeks ccsËd}t|ddÉVg}d}|di}|pdSx¡|oπ|i|i}|ii|dtÉ}|djoPnt|dÉ}|V|diti ti fjo|d i|}nd|i Édjo|i |Én|d 8}q?Wt |d d ÉVy|itÉWntj otd ÉÇnXd}xa|D]Y}|i|di|É} | dj o | Vn|i É\} } | pqQn|i} d | jod|i} nd|i} d|di}| tjo?x§t| ÉD]*}| || | d|ddddÉVqWni| tjo3xXt| ÉD]}| || | d|ÉVqRWn)x%t| ÉD]}| || |ÉVqÖW|d 7}qQW|dj o)|i|É} | dj o | Vq‰ndS(NiR)sNumber of entriesi il`sentry[]R%RitnextsNext IFD offsetsUnable to sort entries!R/s value_%s[]svalue_%ss Value of "%s"iR-s R.s ISO-8859-1(il`(RRiRtabsolute_addressRhtstreamtreadBitsRRCRLRKR5tappendRtsortRet TypeErrorRRjR6R:RIRR7R(Rt offset_difftentriestnext_chunk_offsetR)taddrRktentryt value_indexR+R8R9R R:tdescR=((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRsn          ,      cCsd|diS(NsExif IFD (id %s)tid(R(R((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRJIs(RRRjRRJ(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRfs 7tExifcBseZdÑZRS(ccsët|dddddÉV|didjotdÉÇnt|dd d ddÉV|didjotd ÉÇn|did jo t|_n t|_t|ddÉVt|ddÉVxö|ipè|i |i }|i i |dt É}|djo3|i|i d}t|d|dddÉVPn|djoPnt|ddÉVqÀW|i|iÉ}|dj o |VndS(NtheaderisHeader (Exif\0\0)R.tASCIItExifsInvalid EXIF signature!t byte_orderis Byte ordertIItMMsInvalid endian!tversionsTIFF version numbert img_dir_ofssNext image directory offsetiiÿˇit thumbnailsThumbnail (JPEG file)t mime_types image/jpegiˇˇsifd[]tIFD(sIIRÄ(RRRR tendianR RRteofRlRhRmRnRt_sizeR RftseekBitRi(RRuR%RR+((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRMs2      (RRR(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyRzLsN( t__doc__thachoir_core.fieldRRRRRRRRRR R R thachoir_core.endianR R Rthachoir_core.text_handlerRRthachoir_core.toolsRR4R!R"R#R$RCReRfRz(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/exif.pyt<module>sR Eú E
13,617
Python
.py
63
214.460317
1,686
0.49336
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,671
gif.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/gif.py
""" GIF picture parser. Author: Victor Stinner """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, Enum, UInt8, UInt16, Bit, Bits, NullBytes, String, PascalString8, Character, NullBits, RawBytes) from hachoir_parser.image.common import PaletteRGB from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.tools import humanDuration from hachoir_core.text_handler import textHandler, displayHandler, hexadecimal # Maximum image dimension (in pixel) MAX_WIDTH = 6000 MAX_HEIGHT = MAX_WIDTH MAX_FILE_SIZE = 100 * 1024 * 1024 class Image(FieldSet): def createFields(self): yield UInt16(self, "left", "Left") yield UInt16(self, "top", "Top") yield UInt16(self, "width", "Width") yield UInt16(self, "height", "Height") yield Bits(self, "bpp", 3, "Bits / pixel minus one") yield NullBits(self, "nul", 2) yield Bit(self, "sorted", "Sorted??") yield Bit(self, "interlaced", "Interlaced?") yield Bit(self, "has_local_map", "Use local color map?") if self["has_local_map"].value: nb_color = 1 << (1 + self["bpp"].value) yield PaletteRGB(self, "local_map", nb_color, "Local color map") yield UInt8(self, "code_size", "LZW Minimum Code Size") while True: blen = UInt8(self, "block_len[]", "Block Length") yield blen if blen.value != 0: yield RawBytes(self, "data[]", blen.value, "Image Data") else: break def createDescription(self): return "Image: %ux%u pixels at (%u,%u)" % ( self["width"].value, self["height"].value, self["left"].value, self["top"].value) DISPOSAL_METHOD = { 0: "No disposal specified", 1: "Do not dispose", 2: "Restore to background color", 3: "Restore to previous", } NETSCAPE_CODE = { 1: "Loop count", } def parseApplicationExtension(parent): yield PascalString8(parent, "app_name", "Application name") yield UInt8(parent, "size") size = parent["size"].value if parent["app_name"].value == "NETSCAPE2.0" and size == 3: yield Enum(UInt8(parent, "netscape_code"), NETSCAPE_CODE) if parent["netscape_code"].value == 1: yield UInt16(parent, "loop_count") else: yield RawBytes(parent, "raw", 2) else: yield RawBytes(parent, "raw", size) yield NullBytes(parent, "terminator", 1, "Terminator (0)") def parseGraphicControl(parent): yield UInt8(parent, "size", "Block size (4)") yield Bit(parent, "has_transp", "Has transparency") yield Bit(parent, "user_input", "User input") yield Enum(Bits(parent, "disposal_method", 3), DISPOSAL_METHOD) yield NullBits(parent, "reserved[]", 3) if parent["size"].value != 4: raise ParserError("Invalid graphic control size") yield displayHandler(UInt16(parent, "delay", "Delay time in millisecond"), humanDuration) yield UInt8(parent, "transp", "Transparent color index") yield NullBytes(parent, "terminator", 1, "Terminator (0)") def parseComments(parent): while True: field = PascalString8(parent, "comment[]", strip=" \0\r\n\t") yield field if field.length == 0: break def parseTextExtension(parent): yield UInt8(parent, "block_size", "Block Size") yield UInt16(self, "left", "Text Grid Left") yield UInt16(self, "top", "Text Grid Top") yield UInt16(self, "width", "Text Grid Width") yield UInt16(self, "height", "Text Grid Height") yield UInt8(parent, "cell_width", "Character Cell Width") yield UInt8(parent, "cell_height", "Character Cell Height") yield UInt8(parent, "fg_color", "Foreground Color Index") yield UInt8(parent, "bg_color", "Background Color Index") while True: field = PascalString8(parent, "comment[]", strip=" \0\r\n\t") yield field if field.length == 0: break def defaultExtensionParser(parent): while True: size = UInt8(parent, "size[]", "Size (in bytes)") yield size if 0 < size.value: yield RawBytes(parent, "content[]", size.value) else: break class Extension(FieldSet): ext_code = { 0xf9: ("graphic_ctl[]", parseGraphicControl, "Graphic control"), 0xfe: ("comments[]", parseComments, "Comments"), 0xff: ("app_ext[]", parseApplicationExtension, "Application extension"), 0x01: ("text_ext[]", parseTextExtension, "Plain text extension") } def __init__(self, *args): FieldSet.__init__(self, *args) code = self["code"].value if code in self.ext_code: self._name, self.parser, self._description = self.ext_code[code] else: self.parser = defaultExtensionParser def createFields(self): yield textHandler(UInt8(self, "code", "Extension code"), hexadecimal) for field in self.parser(self): yield field def createDescription(self): return "Extension: function %s" % self["func"].display class ScreenDescriptor(FieldSet): def createFields(self): yield UInt16(self, "width", "Width") yield UInt16(self, "height", "Height") yield Bits(self, "bpp", 3, "Bits per pixel minus one") yield Bit(self, "reserved", "(reserved)") yield Bits(self, "color_res", 3, "Color resolution minus one") yield Bit(self, "global_map", "Has global map?") yield UInt8(self, "background", "Background color") yield UInt8(self, "pixel_aspect_ratio", "Pixel Aspect Ratio") def createDescription(self): colors = 1 << (self["bpp"].value+1) return "Screen descriptor: %ux%u pixels %u colors" \ % (self["width"].value, self["height"].value, colors) class GifFile(Parser): endian = LITTLE_ENDIAN separator_name = { "!": "Extension", ",": "Image", ";": "Terminator" } PARSER_TAGS = { "id": "gif", "category": "image", "file_ext": ("gif",), "mime": (u"image/gif",), "min_size": (6 + 7 + 1 + 9)*8, # signature + screen + separator + image "magic": (("GIF87a", 0), ("GIF89a", 0)), "description": "GIF picture" } def validate(self): if self.stream.readBytes(0, 6) not in ("GIF87a", "GIF89a"): return "Wrong header" if self["screen/width"].value == 0 or self["screen/height"].value == 0: return "Invalid image size" if MAX_WIDTH < self["screen/width"].value: return "Image width too big (%u)" % self["screen/width"].value if MAX_HEIGHT < self["screen/height"].value: return "Image height too big (%u)" % self["screen/height"].value return True def createFields(self): # Header yield String(self, "magic", 3, "File magic code", charset="ASCII") yield String(self, "version", 3, "GIF version", charset="ASCII") yield ScreenDescriptor(self, "screen") if self["screen/global_map"].value: bpp = (self["screen/bpp"].value+1) yield PaletteRGB(self, "color_map", 1 << bpp, "Color map") self.color_map = self["color_map"] else: self.color_map = None self.images = [] while True: code = Enum(Character(self, "separator[]", "Separator code"), self.separator_name) yield code code = code.value if code == "!": yield Extension(self, "extensions[]") elif code == ",": yield Image(self, "image[]") elif code == ";": # GIF Terminator break else: raise ParserError("Wrong GIF image separator: 0x%02X" % ord(code)) def createContentSize(self): field = self["image[0]"] start = field.absolute_address + field.size end = start + MAX_FILE_SIZE*8 pos = self.stream.searchBytes("\0;", start, end) if pos: return pos + 16 return None
8,169
Python
.py
199
33.050251
94
0.604437
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,672
iptc.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/iptc.pyc
Ñò Î ÈMc@sgdZddklZlZlZlZlZlZlZddk l Z l Z dad„Z hZhddefd6dbd 6dcd 6ddefd6ddd6dde fd6dde fd6dde fd6dde fd6d d!e fd"6d#d$e fd%6d&d'e fd(6d)d*e fd+6d,d-e fd.6d/d0e fd16d2d3e fd46d5d6e fd76d8d9e fd:6d;d<e fd=6d>d?e fd@6dAdBe fdC6dDdEe fdF6dGdHe fdI6dJdKe fdL6dMdNe fdO6dPdQe fdR6dSdTe fdU6dVdWe fdX6ZhedY6edZ6Zd[efd\„ƒYZd]efd^„ƒYZd_efd`„ƒYZdaS(esF IPTC metadata parser (can be found in a JPEG picture for example) Sources: - Image-MetaData Perl module: http://www.annocpan.org/~BETTELLI/Image-MetaData-JPEG-0.15/... ...lib/Image/MetaData/JPEG/TagLists.pod - IPTC tag name and description: http://peccatte.karefil.com/software/IPTCTableau.pdf Author: Victor Stinner iÿÿÿÿ(tFieldSett ParserErrortUInt8tUInt16tStringtRawBytest NullBytes(t textHandlert hexadecimalcCs t|||di|ddƒS(Ntsizetstript (Rtvalue(tparenttnametdesc((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyt IPTC_Stringstrecord_versionsRecord version (2 for JPEG)itobj_names Object nameit edit_stats Edit statusiturgencytUrgencyi s category[]tCategoryitfixturesFixture identifieris keyword[]tKeywordsit release_dates Release dateit release_times Release timei#t instructionsSpecial instructionsi(t date_createds Date createdi7t time_createdsTime created (ISO 8601)i<toriginating_progsOriginating programiAtprog_versProgram versioniFtauthorsBy-line (Author)iPt author_jobsBy-line (Author precision)iUtcitytCityiZtstatesProvince / Statei_t country_codesCountry / Primary location codeidt country_namesCountry / Primary location nameiet trans_refsOriginal transmission referenceigtheadlinetHeadlineiitcredittCreditintsourcetSourceist copyrightsCopyright noticeittcaptionsCaption/Abstractixtwriters Writer/editorizs history[]sDocument history (timestamp)içiit IPTC_SizecBseZd„Zd„ZRS(cs[ti|||Žd‰x)|D]!}ˆdK‰ˆ|id@7‰q W‡fd†|_dS(NiiiÿcsˆS((((R (sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyt<lambda>@s(Rt__init__R t createValue(tselftargstkwtfield((R sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyR3:s ccs<x5to-t|dƒ}|V|idjoPqqWdS(Nsvalue[]i€(tTrueRR (R5R8((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyt createFieldsBs (t__name__t __module__R3R:(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyR19s t IPTC_ChunkcBseZd„Zd„ZRS(cOs¶ti|||Ž|di}d|_|tjoW|di}|t|jo5t|||_|id|_|id|_q�n|d}d|i|id|_ dS( Nt dataset_nbttagiiR iii( RR3R tNonet dataset_infotdatasetst_namet _descriptionR t_size(R5R6R7tnumberR?t size_chunk((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyR3Js     ccsçtt|ddƒtƒV|didjotdƒ‚ntt|ddƒtƒVt|ddƒVt|d d ƒV|d i}d |joO|io|id }nd}|o||d ƒVqãt|d |ƒVndS(Nt signaturesIPTC signature (0x1c)isWrong IPTC signatureR>sDataset numberR?tTagR s Content sizeiitcontent( RRRR RR1RAR@R(R5R tcls((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyR:Ws   (R;R<R3R:(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyR=Is tIPTCcBseZd„ZRS(ccskx.d|i|idjot|dƒVqW|i|id}d|jot|d|ƒVndS(Niischunk[]itpadding(REt current_sizeR=R(R5R ((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyR:ks  (R;R<R:(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyRLjsN(Rs Object nameN(Rs Edit statusN(s category[]sCategoryN(t__doc__thachoir_core.fieldRRRRRRRthachoir_core.text_handlerRRR@Rtdataset1tdataset2RBR1R=RL(((sC/pentest/enumeration/google/metagoofil/hachoir_parser/image/iptc.pyt<module> sJ4 !
5,756
Python
.py
27
211.888889
1,084
0.490922
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,673
photoshop_metadata.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/image/photoshop_metadata.py
from hachoir_core.field import (FieldSet, ParserError, UInt8, UInt16, UInt32, String, CString, PascalString8, NullBytes, RawBytes) from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_core.tools import alignValue, createDict from hachoir_parser.image.iptc import IPTC from hachoir_parser.common.win32 import PascalStringWin32 class Version(FieldSet): def createFields(self): yield UInt32(self, "version") yield UInt8(self, "has_realm") yield PascalStringWin32(self, "writer_name", charset="UTF-16-BE") yield PascalStringWin32(self, "reader_name", charset="UTF-16-BE") yield UInt32(self, "file_version") size = (self.size - self.current_size) // 8 if size: yield NullBytes(self, "padding", size) class Photoshop8BIM(FieldSet): TAG_INFO = { 0x03ed: ("res_info", None, "Resolution information"), 0x03f3: ("print_flag", None, "Print flags: labels, crop marks, colour bars, etc."), 0x03f5: ("col_half_info", None, "Colour half-toning information"), 0x03f8: ("color_trans_func", None, "Colour transfer function"), 0x0404: ("iptc", IPTC, "IPTC/NAA"), 0x0406: ("jpeg_qual", None, "JPEG quality"), 0x0408: ("grid_guide", None, "Grid guides informations"), 0x040a: ("copyright_flag", None, "Copyright flag"), 0x040c: ("thumb_res2", None, "Thumbnail resource (2)"), 0x040d: ("glob_angle", None, "Global lighting angle for effects"), 0x0411: ("icc_tagged", None, "ICC untagged (1 means intentionally untagged)"), 0x0414: ("base_layer_id", None, "Base value for new layers ID's"), 0x0419: ("glob_altitude", None, "Global altitude"), 0x041a: ("slices", None, "Slices"), 0x041e: ("url_list", None, "Unicode URL's"), 0x0421: ("version", Version, "Version information"), 0x2710: ("print_flag2", None, "Print flags (2)"), } TAG_NAME = createDict(TAG_INFO, 0) CONTENT_HANDLER = createDict(TAG_INFO, 1) TAG_DESC = createDict(TAG_INFO, 2) def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) try: self._name, self.handler, self._description = self.TAG_INFO[self["tag"].value] except KeyError: self.handler = None size = self["size"] self._size = size.address + size.size + alignValue(size.value, 2) * 8 def createFields(self): yield String(self, "signature", 4, "8BIM signature", charset="ASCII") if self["signature"].value != "8BIM": raise ParserError("Stream doesn't look like 8BIM item (wrong signature)!") yield textHandler(UInt16(self, "tag"), hexadecimal) if self.stream.readBytes(self.absolute_address + self.current_size, 4) != "\0\0\0\0": yield PascalString8(self, "name") size = 2 + (self["name"].size // 8) % 2 yield NullBytes(self, "name_padding", size) else: yield String(self, "name", 4, strip="\0") yield UInt16(self, "size") size = alignValue(self["size"].value, 2) if not size: return if self.handler: yield self.handler(self, "content", size=size*8) else: yield RawBytes(self, "content", size) class PhotoshopMetadata(FieldSet): def createFields(self): yield CString(self, "signature", "Photoshop version") if self["signature"].value == "Photoshop 3.0": while not self.eof: yield Photoshop8BIM(self, "item[]") else: size = (self._size - self.current_size) / 8 yield RawBytes(self, "rawdata", size)
3,709
Python
.py
77
39.714286
93
0.620243
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,674
msoffice.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/msoffice.pyc
Ñò Î ÈMc @sÙdZddklZddklZlZlZddklZddk l Z ddk l Z l Z ddklZhdd 6d d 6d d 6Zdeefd„ƒYZddd„ƒYZdefd„ƒYZdS(s¥ Parsers for the different streams and fragments found in an OLE2 file. Documents: - goffice source code Author: Robert Xiao, Victor Stinner Creation: 2006-04-23 iÿÿÿÿ(t HachoirParser(tFieldSettRootSeekableFieldSettRawBytes(t LITTLE_ENDIAN(tStringInputStream(tSummaryFieldSettCompObj(tWordDocumentFieldSett doc_summaryuDocumentSummaryInformationtsummaryuSummaryInformationtword_docu WordDocumenttOfficeRootEntrycBsHeZhdd6ZeZd„Zd„Zd„Zd„Zd„Z RS(s&Microsoft Office document subfragmentst descriptioncKs<ti|dd|d|i|ƒƒti|||�dS(Ntroot(Rt__init__tNonetaskSizeR(tselftstreamtargs((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyRs%cCstS(N(tTrue(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pytvalidate"sccs˜x‘t|iiƒD]}\}}|djoqnyt|di}Wn tj o|id}nXx"|i|||ƒD] }|Vq�WqWdS(Nitnametcontent(t enumeratetole2t propertiest PROPERTY_NAMEtvaluet LookupErrorRt parseProperty(RtindextpropertyRtfield((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyt createFields%s  c cs!|i}|dipdS|di|dijodSd|}d}d}d}|di} |i| tƒ} |i} d} d} xŽto†ym| iƒ}t}|p|}t}n|o||djo t}n|o|}|| 7}w�nWntj o d}nX|i |ƒ| ||||df}t ||didƒ}|d jot |||d|ƒVni|d jot |||d|ƒVnA|djot |d |d|ƒVnt|||d|ƒV|djoPn|}|}|i}q�WdS(Ntsizesheader/thresholds%s[]itstartsSmall blocks %s..%s (%s)iiR R R tcomp_obj(ssummarys doc_summary(RRRtgetChainRtss_sizetnexttFalset StopIterationt seekSBlocktminRRRRt sector_size(Rtproperty_indexR!t name_prefixRRtfirsttpreviousR$R%tchaint blocksizet desc_formattfragment_grouptblockt contiguoustdesc((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyR0sZ               cCs|i||iiƒdS(N(tseekBitRR((RR7((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyR,_s( t__name__t __module__t PARSER_TAGSRtendianRRR#RR,(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyR s    /t FragmentGroupcBs#eZd„Zd„Zd„ZRS(cCsg|_||_dS(N(titemstparser(RRA((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyRcs cCs|ii|ƒdS(N(R@tappend(Rtitem((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pytaddgscCsŠg}x%|iD]}|i|diƒqWdi|ƒ}h|idid6}h|id6|d6}|iƒ}t|dd|ƒS( NtrawdatatiRtclassRs<fragment group>ttags(R@RBRtjoinRRAt iteritemsR(RtdataRCRRH((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pytcreateInputStreamjs  (R;R<RRDRL(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyR?bs  tCustomFragmentcBs)eZddd„Zd„Zd„ZRS(cCsPti||||d|ƒ|pt|ƒ}n||_|ii|ƒdS(NR$(RRR?tgroupRD(RtparentRR$RAR RN((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyRxs  ccst|d|idƒVdS(NREi(RR$(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyR#scKs |iiƒS(N(RNRL(RR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyt_createInputStream‚sN(R;R<RRR#RP(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyRMws N((t__doc__thachoir_parserRthachoir_core.fieldRRRthachoir_core.endianRthachoir_core.streamRt$hachoir_parser.misc.msoffice_summaryRRthachoir_parser.misc.word_docRRR R?RM(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice.pyt<module> s J
5,894
Python
.py
31
189.032258
1,043
0.454111
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,675
hlp.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/hlp.py
""" Microsoft Windows Help (HLP) parser for Hachoir project. Documents: - Windows Help File Format / Annotation File Format / SHG and MRB File Format written by M. Winterhoff (100326.2776@compuserve.com) found on http://www.wotsit.org/ Author: Victor Stinner Creation date: 2007-09-03 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Bits, Int32, UInt16, UInt32, NullBytes, RawBytes, PaddingBytes, String) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import (textHandler, hexadecimal, displayHandler, humanFilesize) class FileEntry(FieldSet): def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["res_space"].value * 8 def createFields(self): yield displayHandler(UInt32(self, "res_space", "Reserved space"), humanFilesize) yield displayHandler(UInt32(self, "used_space", "Used space"), humanFilesize) yield Bits(self, "file_flags", 8, "(=4)") yield textHandler(UInt16(self, "magic"), hexadecimal) yield Bits(self, "flags", 16) yield displayHandler(UInt16(self, "page_size", "Page size in bytes"), humanFilesize) yield String(self, "structure", 16, strip="\0", charset="ASCII") yield NullBytes(self, "zero", 2) yield UInt16(self, "nb_page_splits", "Number of page splits B+ tree has suffered") yield UInt16(self, "root_page", "Page number of B+ tree root page") yield PaddingBytes(self, "one", 2, pattern="\xFF") yield UInt16(self, "nb_page", "Number of B+ tree pages") yield UInt16(self, "nb_level", "Number of levels of B+ tree") yield UInt16(self, "nb_entry", "Number of entries in B+ tree") size = (self.size - self.current_size)//8 if size: yield PaddingBytes(self, "reserved_space", size) class HlpFile(Parser): PARSER_TAGS = { "id": "hlp", "category": "misc", "file_ext": ("hlp",), "min_size": 32, "description": "Microsoft Windows Help (HLP)", } endian = LITTLE_ENDIAN def validate(self): if self["magic"].value != 0x00035F3F: return "Invalid magic" if self["filesize"].value != self.stream.size//8: return "Invalid magic" return True def createFields(self): yield textHandler(UInt32(self, "magic"), hexadecimal) yield UInt32(self, "dir_start", "Directory start") yield Int32(self, "first_free_block", "First free block") yield UInt32(self, "filesize", "File size in bytes") yield self.seekByte(self["dir_start"].value) yield FileEntry(self, "file[]") size = (self.size - self.current_size)//8 if size: yield RawBytes(self, "end", size)
2,820
Python
.py
63
37.777778
92
0.647595
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,676
pdf.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/pdf.pyc
—Ú Œ »Mc@s<dZddklZddklZlZlZlZlZl Z l Z l Z l Z ddk lZddklZlZdZdZd1dÑZd d d ÑZd efd ÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZ defdÑÉYZ!d ÑZ"d!efd"ÑÉYZ#d#efd$ÑÉYZ$d%efd&ÑÉYZ%d'efd(ÑÉYZ&d)efd*ÑÉYZ'd+efd,ÑÉYZ(d-efd.ÑÉYZ)d/efd0ÑÉYZ*d1S(2sg Adobe Portable Document Format (PDF) parser. Author: Christophe Gisquet <christophe.gisquet@free.fr> iˇˇˇˇ(tParser( tFieldtFieldSett ParserErrort GenericVectortUInt8tUInt16tUInt32tStringtRawBytes(t LITTLE_ENDIAN(t textHandlert hexadecimals%PDF-s%%EOFcCsç|djo|i|id}n|iidtd|É}|iidtd|É}|djp|djo||jo|S|S(Nis s (tNonetabsolute_addresst current_sizetstreamtsearchBytesLengthtFalse(tstpostendt other_end((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyt getLineEnds 't icCsL|i|i}|d|7}|ii|t|É}|djodS|S(Ni(RRRRtTrueR (RtlimittoffsettaddrR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyt getElementEnd!s  t PDFNumbercBs&eZddddgZddÑZRS(t[t/s t]csti|||d|Ét|É}x_|iD]T}t||É}|djo2|d8}|djp ||jo |}qÉq/q/Wd||_|ii|i|Éâ|i d|àfÉài dÉdjoáfdÜ|_ náfdÜ|_ dS( Nt descriptioniisNumber: size=%u value='%s't.iˇˇˇˇcs tàÉS((tfloat((tval(sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyt<lambda>@scs tàÉS((tint((R%(sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR&Bs( Rt__init__RtLIMITSR t_sizeRt readBytesRtinfotfindt createValue(tselftparenttnametdesctsizeRt other_size((R%sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(/s     N(t__name__t __module__R)R R((((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR*st PDFStringcBseZdZddÑZRS(sg A string of the shape: ( This string uses 3 lines with the CR(LF) inhibited ) csti|||d|Édâd}d}x∑|ip¨|ii|id|dÉ}|iÉ p |djo|d7}q.n|djo|d7}n|djo|d8}n|djo|d7}Pnà|7âq.Wd||_áfd Ü|_dS( NR"tiis\t(t)icsàS((((R%(sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR&cs( RR(teofRR+RtisalphaR*R.(R/R0R1R2tcounttofftchar((R%sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(Ks(        N(R5R6t__doc__R R((((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR7DstPDFNamecBs&eZddddgZddÑZRS(RR t<R!cstiàà|d|ÉàiiàidÉdjo&tdàiiàidÉÉÇntàddÉâxbàiD]W}tà|dÉ}|djo2|d8}àdjp |àjo |âq—qzqzWdàdà_ áááfdÜà_ dS( NR"iR sUnknown PDFName '%s'i Rics#àiiàidàÉidÉS(iR(RR+Rtstrip((R/R0R3(sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR&s( RR(RR+RRRR)R R*R.(R/R0R1R2RR4((R0R/R3sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(ls    N(R5R6R)R R((((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRAestPDFIDcBseZdZddÑZRS(sr Not described as an object, but let's do as it was. This ID has the shape <hexadecimal ASCII string> csHtiàà|d|ÉdtàdÉà_ááfdÜà_dS(NR"it>cs%àiiàidàiddÉS(ii(RR+RR*((R/R0(sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR&âs(RR(RR*R.(R/R0R1R2((R0R/sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(ÜsN(R5R6R@R R((((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRDÅstNotABoolcBseZRS((R5R6(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRFãstPDFBoolcBseZdZddÑZRS(sA "true" or "false" string standing for the boolean value cCsìti|||d|É|ii|idÉdjod|_dÑ|_n9|ii|idÉdjod|_dÑ|_ntÇdS(NR"ittruecSstS((R(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR&îsitfalsecSstS((R(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR&ós(RR(RR+RR*R.RF(R/R0R1R2((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(ês  N(R5R6R@R R((((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRGåstLineEndcBseZdZdÑZRS(s? Made of 0x0A, 0x0D (we may include several line ends) ccs£xú|ipë|i|i}|ii|dÉ}|djot|ddÉVq|djot|ddÉVq|id||ii|ifÉPqWdS(Nis tlfs Line feeds tcrsLine ends at %u/%u, len %u(R;RRRR+RR,R*(R/RR?((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyt createFieldsûs    (R5R6R@RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRJöstPDFDictionaryPaircBseZdÑZRS(ccs7t|dt|ÉÉVxt|ÉD] }|Vq$WdS(NR1(RARt parsePDFType(R/tfield((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRM¨s (R5R6RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRN´st PDFDictionarycBseZdÑZRS(ccsÖt|ddÉVx\|ipQ|i|i}|ii|dÉdjo xt|ÉD] }|VqWWqPqWt|ddÉVdS(Nt dict_startis>>tdict_end(RR;RRRR+RO(R/RRP((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRM≤s   (R5R6RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRQ±stPDFArraycBseZdZdÑZRS(s_ Array of possibly non-homogeneous elements, starting with '[' and ending with ']' ccspt|ddÉVxG|ii|i|idÉdjo xt|ÉD] }|VqGWqWt|ddÉVdS(Nt array_startiR!t array_end(RRR+RRRO(R/RP((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRM¬s& (R5R6R@RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRTΩsccsP|i|i}|ii|dÉ}|djot|dt|ÉÉVn|djoD|ii|ddÉdjot|dÉVqLt|dÉVnØ|djot|d ÉVnê|d jot |d ÉVnqt|É}xrdd dgD]a}t||É}|djo?|d8}|djp|d jo||jo |}qYq¯q¯W|ii||É}|ii|d|ddÉ}|i dÉdjo|djot |dÉVnÖ|d d"jo2|i d|i dÉ|fÉt|dÉVnB|i d|ii|i|id É|fÉt|d!|ÉVdS(#NiR stype[]RBisdict[]sid[]R9sstring[]Rsarray[]REiRs catalog[]R#t-t+t0t1t2t3t4t5t6t7t8t9s%Not a catalog: %u spaces and end='%s's integer[]sTrying to parse '%s': %u bytesis unknown[]( R#RWRXRYRZR[R\R]R^R_R`RaRb(RRRR+RARRQRDR7RTR R=tCatalogR,RR(RRR?R3RR4R1((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRO…s>        '!#   'tHeadercBseZdÑZdÑZRS(ccsht|ddtÉVt|dÉ}|djo't|d|dÉVt|dÉVn|idÉdS(Ntmarkeriitversionitline_endsCan't determine version!(RtMAGICRR RJtwarning(R/tlength((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRMÒs  cCsd|diS(NsPDF version %sRf(tdisplay(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pytcreateDescription˙s(R5R6RMRl(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRds tBodycBseZddÑZdÑZRS(cCsnti||||É|iititÉ}|djotd|i dÉÇnd||i |_ dS(NsCan't find xref starting at %ui( RR(RRtCrossReferenceTableRhRR RRR*(R/R0R1R2R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(˛s  c cs∞x„|ii|i|idÉdjoºt|dÉ}|djott|dÉtÉVnt|djott|dÉtÉVnL|ii|i|i|Éi Éot |d|ÉVnt |d|Ét |dÉVqWg}xV|i d ÉD]E}x<|i d ÉD]+}d |jo|i|d iÉqqWq¸W|i|d id É|iÉxBtt|ÉdÉD]*}t|dd||d||ÉVq~WdS(Nit%iitcrc32s comment[]sunknown_data[]s line_end[]s/cross_ref_table/sub_sections entries/itemt byte_offsets/cross_ref_tableisobject[]R3(RR+RRRR RR RR<RR RJtarraytappendtvaluetsorttxrangetlenRc(R/R3toffsetst subsectiontobjtindex((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRMs.&  &   N(R5R6R R(RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRm˝s tEntrycBs eZdZdÑZdÑZRS(iiccsñ|ii|id dÉ}|djot|dÉVn.|djot|dÉVnt|dÉVt|d ÉVt|d ÉVt|d ÉVdS( NiiitnRqtftnext_free_object_numbertunknown_stringtgeneration_numberttypeRgià(RR+RRRRJ(R/ttyp((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRM$s  cCsg|didjodt|diÉS|didjodt|diÉSd|d iSdS( NRÇR}sIn-use entry at offset %uRqR~s"Free entry before in-use object %uRs unknown %sRÄ(RtR'(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRl/s i†(R5R6t static_sizeRMRl(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR|"s t SubSectioncBs&eZddÑZdÑZdÑZRS(cCs^ti||||É|id|diÉ|idt|diÉ|di|_dS(NsGot entry count: '%s't entry_countiiRgi†(RR(R,RtRR'R3R*(R/R0R1R2((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(9sccsÖt|ddÉV|id|diÉt|ddÉV|id|diÉt|dÉVt|dt|diÉtÉVdS( Nt start_numbers*Object number of first entry in subsectionsstart_number = %iRÜsNumber of entries in subsectionsentry_count = %iRgtentries(RR,RtRJRR'R|(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRM?s cCsd|di|dfS(Ns+Subsection with %s elements, starting at %sRÜRá(Rt(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRlJsN(R5R6R R(RMRl(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRÖ8s  RncBs#eZdZddÑZdÑZRS(txrefcCsyti|||d|É|iititÉ}|djo#tdti|i dÉÉÇnd||i |_ dS(NR"sCan't find '%s' starting at %ui( RR(RRtTrailerRhRR RRR*(R/R0R1R2R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(Qs  ccsLt|dt|iÉÉVt|dÉVx|ipt|dÉVq+WdS(NRes line_end[]s sub_section[](R RwRhRJR;RÖ(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRMYs  N(R5R6RhR R(RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRnNs RccBs/eZdddgZdddÑZdÑZRS(RBR RcCsäti|||d|É|djod||_nP|didjo;|iidtÉ}|djod|d|_qÜndS(NR"itobjectRztendobji(RR(R R*RtRRR(R/R0R1R3R2((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR(as  ccs$t|dÉVt|dÉVt|É}x[|iD]P}t||Ét|É}|djp|djo||jo |}q2q2Wt|d|ddÉV|ii|i|i dÉdjot |dÉVn|di d jo7t |d ÉVt|d td ÉÉVt |d ÉVndS( NR{s unknown[]RãRCRis<<tkey_listRzs line_end[]t end_objectRå( RRtEND_NAMERwR RRR+RRRQRtRJ(R/RjRt new_length((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRMjs  '&N(R5R6RèR R(RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRc_s RäcBseZdZdÑZRS(ttrailerccs˚t|dt|iÉÉVt|dÉVt|ddÉV|i|i}x,|ii|dÉdjot |dÉ}|V|i }|i d|É|djot |d d ÉVn¨|d jot |d ÉVnç|d jot |dÉVnn|djot |dÉVnO|djot|dÉVn0|djot|dÉVntd|ÉÇ|i|i}qLWt|ddÉVt|dÉVt|ddÉVt|dÉVt |dÉVt|dÉVt|dttÉÉVt|dÉVdS(NRes line_end[]tstart_attribute_markeris>>stype[]sParsing PDFName '%s'tSizeR3s+Entries in the file cross-reference sectiontPrevRtRoottobject_catalogtInfoR,tIDtidtEncrypttdecryptsDon't know trailer type '%s'tend_attribute_markert start_xrefi tcross_ref_table_start_addresst end_marker(R RwRhRJRRRRR+RARtR,RRcRTRQRtENDMAGIC(R/RttR1((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRM}s@       (R5R6RhRM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRä{st PDFDocumentcBs`eZeZhdd6dd6dd6dd6dd 6edffd 6d d 6ZdÑZdÑZRS(tpdfRôtmisctcategorytfile_extuapplication/pdftmimeiiitmin_sizetmagics'Portable Document Format (PDF) documentR"cCs+|iidttÉÉtjodStS(NisInvalid magic string(RR+RwRhR(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pytvalidate´s"ccs<t|dÉVt|dÉVt|dÉVt|dÉVdS(Ntheadertbodytcross_ref_tableRë(RdRmRnRä(R/((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyRMµs(spdf(uapplication/pdfi iH(R5R6R tendianRht PARSER_TAGSR™RM(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyR¢üs  N(+R@thachoir_parserRthachoir_core.fieldRRRRRRRRR thachoir_core.endianR thachoir_core.text_handlerR R RhR†R RRRR7RARDt ExceptionRFRGRJRNRQRTRORdRmR|RÖRnRcRäR¢(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pdf.pyt<module>s6@  !   ' %$
20,348
Python
.py
82
246.487805
1,501
0.412514
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,677
common.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/common.pyc
Ñò Î ÈMc@sFddklZlZdefd„ƒYZdefd„ƒYZdS(iÿÿÿÿ(tStaticFieldSettFloat32tVertexcBs2eZedfedfedffZd„ZRS(txtytzcCs"|di|di|difS(NRRR(tvalue(tself((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/common.pyt createValues(t__name__t __module__RtformatR(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/common.pyRs!tMapUVcBs)eZedfedffZd„ZRS(tutvcCs|di|difS(NR R(R(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/common.pyR s(R R RR R(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/common.pyR sN(thachoir_core.fieldRRRR (((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/common.pyt<module>s
1,198
Python
.py
4
298.5
483
0.451883
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,678
bplist.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/bplist.pyc
—Ú Œ »Mc @skdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZddklZddklZddklZddklZlZdefd ÑÉYZd efd ÑÉYZd efd ÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdefdÑÉYZdeefdÑÉYZ dS(sm Apple/NeXT Binary Property List (BPLIST) parser. Also includes a .createXML() function which produces an XML representation of the object. Note that it will discard unknown objects, nulls and fill values, but should work for most files. Documents: - CFBinaryPList.c http://src.gnu-darwin.org/DarwinSourceArchive/expanded/CF/CF-299/Parsing.subproj/CFBinaryPList.c - ForFoundationOnly.h (for structure formats) http://src.gnu-darwin.org/DarwinSourceArchive/expanded/CF/CF-299/Base.subproj/ForFoundationOnly.h - XML <-> BPList converter http://scw.us/iPhone/plutil/plutil.pl Author: Robert Xiao Created: 2008-09-21 iˇˇˇˇ(t HachoirParser( tRootSeekableFieldSettFieldSettEnumtBitstGenericIntegertFloat32tFloat64tUInt8tUInt64tBytest NullBytestRawBytestString(t BIG_ENDIAN(tdisplayHandler(t humanDatetime(tdatetimet timedeltat BPListTrailercBseZdÑZdÑZRS(ccsjt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|d d ÉVt|d d ÉVdS( Ntunusedit offsetIntSizes.Size (in bytes) of offsets in the offset tablet objectRefSizes6Size (in bytes) of object numbers in object referencest numObjectssNumber of objects in this filet topObjectsTop-level object referencetoffsetTableOffsetsFile offset to the offset table(R RR (tself((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyt createFieldss cCsdS(NsBinary PList trailer((R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pytcreateDescription#s(t__name__t __module__RR(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRs tBPListOffsetTablecBseZdÑZRS(ccsD|did}x,t|diÉD]}t|d|ÉVq%WdS(Ns../trailer/offsetIntSizeis../trailer/numObjectssoffset[](tvaluetrangeR(Rtsizeti((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR's(RRR(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR&st BPListSizecBseZdÑZdÑZRS(ccs;t|ddÉV|didjot|dÉVndS(NR"iitfullsize(RR t BPListObject(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR-scCs(d|jo |diS|diSdS(NR%R"(R (R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyt createValue2s  (RRRR'(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR$,s tBPListObjectRefcBs2eZddÑZdÑZdÑZddÑZRS(cCs1|did}ti|||t||ÉdS(Ns/trailer/objectRefSizei(R Rt__init__tFalse(Rtparenttnamet descriptionR"((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR)9scCs|idt|iÉdS(Ns/object[t](R+tstrR (R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pytgetRef=scCs |iÉiS(N(R0tdisplay(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyt createDisplay@stcCs|iÉi|ÉS(N(R0t createXML(Rtprefix((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR4CsN(RRtNoneR)R0R2R4(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR(8s   t BPListArraycBs;eZddÑZdÑZdÑZdÑZddÑZRS(cCs&ti|||d|É||_dS(NR-(RR)tnumels(RR+R,R"R-((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR)Gsccs,x%t|iÉD]}t|dÉVqWdS(Nsref[](R!R8R((RR#((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRKscCs |idÉS(Ntref(tarray(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR'OscCs6ddig}|iD]}||iq~ÉdS(Nt[s, R.(tjoinR R1(Rt_[1]tx((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR2RsR3cCsL|ddig}|iD]}||i|dÉdq~É|dS(Ns<array> R3s s s</array>(R<R R4(RR5R=R>((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR4UsN(RRR6R)RR'R2R4(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR7Fs     t BPListDictcBs;eZddÑZdÑZdÑZdÑZddÑZRS(cCs&ti|||d|É||_dS(NR-(RR)R8(RR+R,R"R-((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR)YsccsTx%t|iÉD]}t|dÉVqWx%t|iÉD]}t|dÉVq8WdS(Nskeyref[]svalref[](R!R8R((RR#((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR]s cCst|idÉ|idÉÉS(Ntkeyreftvalref(tzipR:(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR'cscCsIddig}|iD]#\}}|d|i|ifq~ÉdS(Nt{s, s%s: %st}(R<R R1(RR=tktv((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR2fsR3c Csm|ddig}|iD]?\}}|d||iÉiidÉ|i|dÉfq~É|dS(Ns<dict> R3s%s <key>%s</key> %s sutf-8s s</dict>(R<R R0tencodeR4(RR5R=RERF((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR4isN(RRR6R)RR'R2R4(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR?Xs     R&cBs8eZdÑZdÑZdÑZddÑZdÑZRS(c#swttàddÉh dd6dd6dd6d d 6d d6d d 6dd6dd6dd6dd6ÉVàdi}|djoéttàddÉhdd6dd6dd6dd6ÉVàdidjodÑà_qsàdidjodÑà_qsdÑà_nl|djoYtàd dd!ÉVàd i}tàd|d jd|dÉVáfd"Üà_n|djoñtàd dd!ÉVàd idjotàdÉVnGàd id jotàdÉVn!tàddàd idÉVáfd#Üà_nc|d joVtàd$dd%ÉVd&ÑâttàdÉáfd'ÜÉVááfd(Üà_n|djo<t àd ÉVt àdàd iÉVáfd)Üà_n∑|d joBt àd ÉVt àdàd id*d+ÉVáfd,Üà_nh|djoFt àd ÉVt àdàd idd*d-ÉVáfd.Üà_n|djoGtàd dd/ÉVtàdt àd iddÉVd0Ñà_n¡|djoMt àd ÉVàd i}|o't àd|ÉVáfd1Üà_qsng|djo<t àd ÉVtàdàd iÉVáfd2Üà_ntàddÉVd3Ñà_dS(4Nt marker_typeitSimpleitIntitRealitDateitDatas ASCII StringisUTF-16-BE StringitUIDitArrayi tDicti R tNullR*tTruei s Fill ByteicSs|dS(s<false/>((R5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyt<lambda>ÇscSs|dS(s<true/>((R5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRSÑscSs|dS(R3((R5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRSÜsR"slog2 of number of bytescs|dàdiS(s<integer>%s</integer>R (R (R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRSèscs|dàdiS(s<real>%s</real>R (R (R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRSõstextrasExtra value, should be 3cSstdddÉtd|ÉS(i—itseconds(RR(RF((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS†scstà|ÉÉS((R(R>(tcvt_time(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS°scs|dààdiÉiÉS(s<date>%s</date>R (R t isoformat(R5(RRV(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS¢scs(|dàdiidÉiÉ|fS(s<data> %s %s</data>R tbase64(R RGtstrip(R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS®stcharsettASCIIcs|dàdiidÉS(s<string>%s</string>R s iso-8859-1(R RG(R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRSÆss UTF-16-BEcs|dàdiidÉS(s<string>%s</string>R sutf-8(R RG(R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS¥ssNumber of bytes minus 1cSs|dS(R3((R5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS∫scsàdi|ÉS(R (R4(R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS¬scsàdi|ÉS(R (R4(R5(R(sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRS»scSsdS(R3((R5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRSÃs(RRR R1txmlRRRRR$R R R*R7R?(Rt markertypeR"((RRVsD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRmsä        "        " #   cCs!d|jo |diSdSdS(NR (R R6(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR'Œs  cCs'd|jot|diÉSdSdS(NR (tunicodeR1R6(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR2‘s R3cCs=d|jo,y|i|ÉSWq9tj odSXndS(NR R3(R\tAttributeError(RR5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR4⁄s   cCsdti|É|difS(Ns%s<%s>RH(Rt getFieldTypeR1(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR`‚s(RRRR'R2R4R`(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR&ls  a   tBPListcBsteZeZdZhdd6dd6dd6edffd6dd 6d d 6ZdÑZdÑZdÑZddÑZ RS(tbplist00tbplisttidtmisctcategorytplisttfile_extitmagicii tmin_sizesApple/NeXT Binary Property ListR-cKs<ti|dd|d|i|ÉÉti|||çdS(Ntroot(RR)R6taskSizeR(Rtstreamtargs((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR)Òs%cCs |di|ijodStS(NRisInvalid magic.(R tMAGICRR(R((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pytvalidateısccsAt|dddÉV|io|i|iddtÉnDx(to y|idÉWq@Pq@Xq@W|i|iddÉt|dÉV|i|diÉt|dÉVxä|id ÉD]y}|i|idjo|i|iÉn;|i|idjo#t |d |i|idÉVnt |d ÉVq¿WdS( NRiisFile magic (bplist00)i ittrailerstrailer/offsetTableOffsett offset_tablesoffset_table/offsets padding[]sobject[]( R R"tseekByteRRRR RR:t current_sizeR R&(RR#((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR˙s(  #R3cCs.d|dt|diÉdi|ÉdS(Ns≠<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> s/object[s/trailer/topObjectR.s </plist>(R/R R4(RR5((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyR4s)(splisti(( RRRtendianRot PARSER_TAGSR)RpRR4(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyRaÂs    N(!t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R thachoir_core.endianRthachoir_core.text_handlerRthachoir_core.toolsRRRRRR$R(R7R?R&Ra(((sD/pentest/enumeration/google/metagoofil/hachoir_parser/misc/bplist.pyt<module>sX  y
16,153
Python
.py
60
268.083333
2,906
0.456687
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,679
lnk.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/lnk.py
""" Windows Shortcut (.lnk) parser. Documents: - The Windows Shortcut File Format (document version 1.0) Reverse-engineered by Jesse Hager http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Format.pdf - Wine source code: http://source.winehq.org/source/include/shlobj.h (SHELL_LINK_DATA_FLAGS enum) http://source.winehq.org/source/dlls/shell32/pidl.h - Microsoft: http://msdn2.microsoft.com/en-us/library/ms538128.aspx Author: Robert Xiao, Victor Stinner Changes: 2007-06-27 - Robert Xiao * Fixes to FileLocationInfo to correctly handle Unicode paths 2007-06-13 - Robert Xiao * ItemID, FileLocationInfo and ExtraInfo structs, correct Unicode string handling 2007-03-15 - Victor Stinner * Creation of the parser """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, CString, String, UInt32, UInt16, UInt8, Bit, Bits, PaddingBits, TimestampWin64, DateTimeMSDOS32, NullBytes, PaddingBytes, RawBytes, Enum) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal from hachoir_parser.common.win32 import GUID from hachoir_parser.common.msdos import MSDOSFileAttr16, MSDOSFileAttr32 from hachoir_core.text_handler import filesizeHandler from hachoir_core.tools import paddingSize class ItemIdList(FieldSet): def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = (self["size"].value+2) * 8 def createFields(self): yield UInt16(self, "size", "Size of item ID list") while True: item = ItemId(self, "itemid[]") yield item if not item["length"].value: break class ItemId(FieldSet): ITEM_TYPE = { 0x1F: "GUID", 0x23: "Drive", 0x25: "Drive", 0x29: "Drive", 0x2E: "GUID", 0x2F: "Drive", 0x30: "Dir/File", 0x31: "Directory", 0x32: "File", 0x34: "File [Unicode Name]", 0x41: "Workgroup", 0x42: "Computer", 0x46: "Net Provider", 0x47: "Whole Network", 0x61: "MSITStore", 0x70: "Printer/RAS Connection", 0xB1: "History/Favorite", 0xC3: "Network Share", } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) if self["length"].value: self._size = self["length"].value * 8 else: self._size = 16 def createFields(self): yield UInt16(self, "length", "Length of Item ID Entry") if not self["length"].value: return yield Enum(UInt8(self, "type"),self.ITEM_TYPE) entrytype=self["type"].value if entrytype in (0x1F, 0x2E, 0x70): # GUID yield RawBytes(self, "dummy", 1, "should be 0x50") yield GUID(self, "guid") elif entrytype in (0x23, 0x25, 0x29, 0x2F): # Drive yield String(self, "drive", self["length"].value-3, strip="\0") elif entrytype in (0x30, 0x31, 0x32): yield RawBytes(self, "dummy", 1, "should be 0x00") yield UInt32(self, "size", "size of file; 0 for folders") yield DateTimeMSDOS32(self, "date_time", "File/folder date and time") yield MSDOSFileAttr16(self, "attribs", "File/folder attributes") yield CString(self, "name", "File/folder name") if self.root.hasUnicodeNames(): # Align to 2-bytes n = paddingSize(self.current_size//8, 2) if n: yield PaddingBytes(self, "pad", n) yield UInt16(self, "length_w", "Length of wide struct member") yield RawBytes(self, "unknown[]", 6) yield DateTimeMSDOS32(self, "creation_date_time", "File/folder creation date and time") yield DateTimeMSDOS32(self, "access_date_time", "File/folder last access date and time") yield RawBytes(self, "unknown[]", 4) yield CString(self, "unicode_name", "File/folder name", charset="UTF-16-LE") yield RawBytes(self, "unknown[]", 2) else: yield CString(self, "name_short", "File/folder short name") elif entrytype in (0x41, 0x42, 0x46): yield RawBytes(self, "unknown[]", 2) yield CString(self, "name") yield CString(self, "protocol") yield RawBytes(self, "unknown[]", 2) elif entrytype == 0x47: # Whole Network yield RawBytes(self, "unknown[]", 2) yield CString(self, "name") elif entrytype == 0xC3: # Network Share yield RawBytes(self, "unknown[]", 2) yield CString(self, "name") yield CString(self, "protocol") yield CString(self, "description") yield RawBytes(self, "unknown[]", 2) else: yield RawBytes(self, "raw", self["length"].value-3) def createDescription(self): if self["length"].value: return "Item ID Entry: "+self.ITEM_TYPE.get(self["type"].value,"Unknown") else: return "End of Item ID List" def formatVolumeSerial(field): val = field.value return '%04X-%04X'%(val>>16, val&0xFFFF) class LocalVolumeTable(FieldSet): VOLUME_TYPE={ 1: "No root directory", 2: "Removable (Floppy, Zip, etc.)", 3: "Fixed (Hard disk)", 4: "Remote (Network drive)", 5: "CD-ROM", 6: "Ram drive", } def createFields(self): yield UInt32(self, "length", "Length of this structure") yield Enum(UInt32(self, "volume_type", "Volume Type"),self.VOLUME_TYPE) yield textHandler(UInt32(self, "volume_serial", "Volume Serial Number"), formatVolumeSerial) yield UInt32(self, "label_offset", "Offset to volume label") padding = self.seekByte(self["label_offset"].value) if padding: yield padding yield CString(self, "drive") def hasValue(self): return bool(self["drive"].value) def createValue(self): return self["drive"].value class NetworkVolumeTable(FieldSet): def createFields(self): yield UInt32(self, "length", "Length of this structure") yield UInt32(self, "unknown[]") yield UInt32(self, "share_name_offset", "Offset to share name") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") padding = self.seekByte(self["share_name_offset"].value) if padding: yield padding yield CString(self, "share_name") def createValue(self): return self["share_name"].value class FileLocationInfo(FieldSet): def createFields(self): yield UInt32(self, "length", "Length of this structure") if not self["length"].value: return yield UInt32(self, "first_offset_pos", "Position of first offset") has_unicode_paths = (self["first_offset_pos"].value == 0x24) yield Bit(self, "on_local_volume") yield Bit(self, "on_network_volume") yield PaddingBits(self, "reserved[]", 30) yield UInt32(self, "local_info_offset", "Offset to local volume table; only meaningful if on_local_volume = 1") yield UInt32(self, "local_pathname_offset", "Offset to local base pathname; only meaningful if on_local_volume = 1") yield UInt32(self, "remote_info_offset", "Offset to network volume table; only meaningful if on_network_volume = 1") yield UInt32(self, "pathname_offset", "Offset of remaining pathname") if has_unicode_paths: yield UInt32(self, "local_pathname_unicode_offset", "Offset to Unicode version of local base pathname; only meaningful if on_local_volume = 1") yield UInt32(self, "pathname_unicode_offset", "Offset to Unicode version of remaining pathname") if self["on_local_volume"].value: padding = self.seekByte(self["local_info_offset"].value) if padding: yield padding yield LocalVolumeTable(self, "local_volume_table", "Local Volume Table") padding = self.seekByte(self["local_pathname_offset"].value) if padding: yield padding yield CString(self, "local_base_pathname", "Local Base Pathname") if has_unicode_paths: padding = self.seekByte(self["local_pathname_unicode_offset"].value) if padding: yield padding yield CString(self, "local_base_pathname_unicode", "Local Base Pathname in Unicode", charset="UTF-16-LE") if self["on_network_volume"].value: padding = self.seekByte(self["remote_info_offset"].value) if padding: yield padding yield NetworkVolumeTable(self, "network_volume_table") padding = self.seekByte(self["pathname_offset"].value) if padding: yield padding yield CString(self, "final_pathname", "Final component of the pathname") if has_unicode_paths: padding = self.seekByte(self["pathname_unicode_offset"].value) if padding: yield padding yield CString(self, "final_pathname_unicode", "Final component of the pathname in Unicode", charset="UTF-16-LE") padding=self.seekByte(self["length"].value) if padding: yield padding class LnkString(FieldSet): def createFields(self): yield UInt16(self, "length", "Length of this string") if self.root.hasUnicodeNames(): yield String(self, "data", self["length"].value*2, charset="UTF-16-LE") else: yield String(self, "data", self["length"].value, charset="ASCII") def createValue(self): return self["data"].value class ColorRef(FieldSet): ''' COLORREF struct, 0x00bbggrr ''' static_size=32 def createFields(self): yield UInt8(self, "red", "Red") yield UInt8(self, "green", "Green") yield UInt8(self, "blue", "Blue") yield PaddingBytes(self, "pad", 1, "Padding (must be 0)") def createDescription(self): rgb = self["red"].value, self["green"].value, self["blue"].value return "RGB Color: #%02X%02X%02X" % rgb class ColorTableIndex(Bits): def __init__(self, parent, name, size, description=None): Bits.__init__(self, parent, name, size, None) self.desc=description def createDescription(self): assert hasattr(self, 'parent') and hasattr(self, 'value') return "%s: %s"%(self.desc, self.parent["color[%i]"%self.value].description) class ExtraInfo(FieldSet): INFO_TYPE={ 0xA0000001: "Link Target Information", # EXP_SZ_LINK_SIG 0xA0000002: "Console Window Properties", # NT_CONSOLE_PROPS_SIG 0xA0000003: "Hostname and Other Stuff", 0xA0000004: "Console Codepage Information", # NT_FE_CONSOLE_PROPS_SIG 0xA0000005: "Special Folder Info", # EXP_SPECIAL_FOLDER_SIG 0xA0000006: "DarwinID (Windows Installer ID) Information", # EXP_DARWIN_ID_SIG 0xA0000007: "Custom Icon Details", # EXP_LOGO3_ID_SIG or EXP_SZ_ICON_SIG } SPECIAL_FOLDER = { 0: "DESKTOP", 1: "INTERNET", 2: "PROGRAMS", 3: "CONTROLS", 4: "PRINTERS", 5: "PERSONAL", 6: "FAVORITES", 7: "STARTUP", 8: "RECENT", 9: "SENDTO", 10: "BITBUCKET", 11: "STARTMENU", 16: "DESKTOPDIRECTORY", 17: "DRIVES", 18: "NETWORK", 19: "NETHOOD", 20: "FONTS", 21: "TEMPLATES", 22: "COMMON_STARTMENU", 23: "COMMON_PROGRAMS", 24: "COMMON_STARTUP", 25: "COMMON_DESKTOPDIRECTORY", 26: "APPDATA", 27: "PRINTHOOD", 28: "LOCAL_APPDATA", 29: "ALTSTARTUP", 30: "COMMON_ALTSTARTUP", 31: "COMMON_FAVORITES", 32: "INTERNET_CACHE", 33: "COOKIES", 34: "HISTORY", 35: "COMMON_APPDATA", 36: "WINDOWS", 37: "SYSTEM", 38: "PROGRAM_FILES", 39: "MYPICTURES", 40: "PROFILE", 41: "SYSTEMX86", 42: "PROGRAM_FILESX86", 43: "PROGRAM_FILES_COMMON", 44: "PROGRAM_FILES_COMMONX86", 45: "COMMON_TEMPLATES", 46: "COMMON_DOCUMENTS", 47: "COMMON_ADMINTOOLS", 48: "ADMINTOOLS", 49: "CONNECTIONS", 53: "COMMON_MUSIC", 54: "COMMON_PICTURES", 55: "COMMON_VIDEO", 56: "RESOURCES", 57: "RESOURCES_LOCALIZED", 58: "COMMON_OEM_LINKS", 59: "CDBURN_AREA", 61: "COMPUTERSNEARME", } BOOL_ENUM = { 0: "False", 1: "True", } def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) if self["length"].value: self._size = self["length"].value * 8 else: self._size = 32 def createFields(self): yield UInt32(self, "length", "Length of this structure") if not self["length"].value: return yield Enum(textHandler(UInt32(self, "signature", "Signature determining the function of this structure"),hexadecimal),self.INFO_TYPE) if self["signature"].value == 0xA0000003: # Hostname and Other Stuff yield UInt32(self, "remaining_length") yield UInt32(self, "unknown[]") yield String(self, "hostname", 16, "Computer hostname on which shortcut was last modified", strip="\0") yield RawBytes(self, "unknown[]", 32) yield RawBytes(self, "unknown[]", 32) elif self["signature"].value == 0xA0000005: # Special Folder Info yield Enum(UInt32(self, "special_folder_id", "ID of the special folder"),self.SPECIAL_FOLDER) yield UInt32(self, "offset", "Offset to Item ID entry") elif self["signature"].value in (0xA0000001, 0xA0000006, 0xA0000007): if self["signature"].value == 0xA0000001: # Link Target Information object_name="target" elif self["signature"].value == 0xA0000006: # DarwinID (Windows Installer ID) Information object_name="darwinID" else: # Custom Icon Details object_name="icon_path" yield CString(self, object_name, "Data (ASCII format)", charset="ASCII") remaining = self["length"].value - self.current_size/8 - 260*2 # 260*2 = size of next part if remaining: yield RawBytes(self, "slack_space[]", remaining, "Data beyond end of string") yield CString(self, object_name+'_unicode', "Data (Unicode format)", charset="UTF-16-LE", truncate="\0") remaining = self["length"].value - self.current_size/8 if remaining: yield RawBytes(self, "slack_space[]", remaining, "Data beyond end of string") elif self["signature"].value == 0xA0000002: # Console Window Properties yield ColorTableIndex(self, "color_text", 4, "Screen text color index") yield ColorTableIndex(self, "color_bg", 4, "Screen background color index") yield NullBytes(self, "reserved[]", 1) yield ColorTableIndex(self, "color_popup_text", 4, "Pop-up text color index") yield ColorTableIndex(self, "color_popup_bg", 4, "Pop-up background color index") yield NullBytes(self, "reserved[]", 1) yield UInt16(self, "buffer_width", "Screen buffer width (character cells)") yield UInt16(self, "buffer_height", "Screen buffer height (character cells)") yield UInt16(self, "window_width", "Window width (character cells)") yield UInt16(self, "window_height", "Window height (character cells)") yield UInt16(self, "position_left", "Window distance from left edge (screen coords)") yield UInt16(self, "position_top", "Window distance from top edge (screen coords)") yield UInt32(self, "font_number") yield UInt32(self, "input_buffer_size") yield UInt16(self, "font_width", "Font width in pixels; 0 for a non-raster font") yield UInt16(self, "font_height", "Font height in pixels; equal to the font size for non-raster fonts") yield UInt32(self, "font_family") yield UInt32(self, "font_weight") yield String(self, "font_name_unicode", 64, "Font Name (Unicode format)", charset="UTF-16-LE", truncate="\0") yield UInt32(self, "cursor_size", "Relative size of cursor (% of character size)") yield Enum(UInt32(self, "full_screen", "Run console in full screen?"), self.BOOL_ENUM) yield Enum(UInt32(self, "quick_edit", "Console uses quick-edit feature (using mouse to cut & paste)?"), self.BOOL_ENUM) yield Enum(UInt32(self, "insert_mode", "Console uses insertion mode?"), self.BOOL_ENUM) yield Enum(UInt32(self, "auto_position", "System automatically positions window?"), self.BOOL_ENUM) yield UInt32(self, "history_size", "Size of the history buffer (in lines)") yield UInt32(self, "history_count", "Number of history buffers (each process gets one up to this limit)") yield Enum(UInt32(self, "history_no_dup", "Automatically eliminate duplicate lines in the history buffer?"), self.BOOL_ENUM) for index in xrange(16): yield ColorRef(self, "color[]") elif self["signature"].value == 0xA0000004: # Console Codepage Information yield UInt32(self, "codepage", "Console's code page") else: yield RawBytes(self, "raw", self["length"].value-self.current_size/8) def createDescription(self): if self["length"].value: return "Extra Info Entry: "+self["signature"].display else: return "End of Extra Info" HOT_KEYS = { 0x00: u'None', 0x13: u'Pause', 0x14: u'Caps Lock', 0x21: u'Page Up', 0x22: u'Page Down', 0x23: u'End', 0x24: u'Home', 0x25: u'Left', 0x26: u'Up', 0x27: u'Right', 0x28: u'Down', 0x2d: u'Insert', 0x2e: u'Delete', 0x6a: u'Num *', 0x6b: u'Num +', 0x6d: u'Num -', 0x6e: u'Num .', 0x6f: u'Num /', 0x90: u'Num Lock', 0x91: u'Scroll Lock', 0xba: u';', 0xbb: u'=', 0xbc: u',', 0xbd: u'-', 0xbe: u'.', 0xbf: u'/', 0xc0: u'`', 0xdb: u'[', 0xdc: u'\\', 0xdd: u']', 0xde: u"'", } def text_hot_key(field): assert hasattr(field, "value") val=field.value if 0x30 <= val <= 0x39: return unichr(val) elif 0x41 <= val <= 0x5A: return unichr(val) elif 0x60 <= val <= 0x69: return u'Numpad %c' % unichr(val-0x30) elif 0x70 <= val <= 0x87: return 'F%i'%(val-0x6F) elif val in HOT_KEYS: return HOT_KEYS[val] return str(val) class LnkFile(Parser): MAGIC = "\x4C\0\0\0\x01\x14\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" PARSER_TAGS = { "id": "lnk", "category": "misc", "file_ext": ("lnk",), "mime": (u"application/x-ms-shortcut",), "magic": ((MAGIC, 0),), "min_size": len(MAGIC)*8, # signature + guid = 20 bytes "description": "Windows Shortcut (.lnk)", } endian = LITTLE_ENDIAN SHOW_WINDOW_STATE = { 0: u"Hide", 1: u"Show Normal", 2: u"Show Minimized", 3: u"Show Maximized", 4: u"Show Normal, not activated", 5: u"Show", 6: u"Minimize", 7: u"Show Minimized, not activated", 8: u"Show, not activated", 9: u"Restore", 10: u"Show Default", } def validate(self): if self["signature"].value != 0x0000004C: return "Invalid signature" if self["guid"].value != "00021401-0000-0000-C000-000000000046": return "Invalid GUID" return True def hasUnicodeNames(self): return self["has_unicode_names"].value def createFields(self): yield UInt32(self, "signature", "Shortcut signature (0x0000004C)") yield GUID(self, "guid", "Shortcut GUID (00021401-0000-0000-C000-000000000046)") yield Bit(self, "has_shell_id", "Is the Item ID List present?") yield Bit(self, "target_is_file", "Is a file or a directory?") yield Bit(self, "has_description", "Is the Description field present?") yield Bit(self, "has_rel_path", "Is the relative path to the target available?") yield Bit(self, "has_working_dir", "Is there a working directory?") yield Bit(self, "has_cmd_line_args", "Are there any command line arguments?") yield Bit(self, "has_custom_icon", "Is there a custom icon?") yield Bit(self, "has_unicode_names", "Are Unicode names used?") yield Bit(self, "force_no_linkinfo") yield Bit(self, "has_exp_sz") yield Bit(self, "run_in_separate") yield Bit(self, "has_logo3id", "Is LOGO3 ID info present?") yield Bit(self, "has_darwinid", "Is the DarwinID info present?") yield Bit(self, "runas_user", "Is the target run as another user?") yield Bit(self, "has_exp_icon_sz", "Is custom icon information available?") yield Bit(self, "no_pidl_alias") yield Bit(self, "force_unc_name") yield Bit(self, "run_with_shim_layer") yield PaddingBits(self, "reserved[]", 14, "Flag bits reserved for future use") yield MSDOSFileAttr32(self, "target_attr") yield TimestampWin64(self, "creation_time") yield TimestampWin64(self, "modification_time") yield TimestampWin64(self, "last_access_time") yield filesizeHandler(UInt32(self, "target_filesize")) yield UInt32(self, "icon_number") yield Enum(UInt32(self, "show_window"), self.SHOW_WINDOW_STATE) yield textHandler(UInt8(self, "hot_key", "Hot key used for quick access"),text_hot_key) yield Bit(self, "hot_key_shift", "Hot key: is Shift used?") yield Bit(self, "hot_key_ctrl", "Hot key: is Ctrl used?") yield Bit(self, "hot_key_alt", "Hot key: is Alt used?") yield PaddingBits(self, "hot_key_reserved", 21, "Hot key: (reserved)") yield NullBytes(self, "reserved[]", 8) if self["has_shell_id"].value: yield ItemIdList(self, "item_idlist", "Item ID List") if self["target_is_file"].value: yield FileLocationInfo(self, "file_location_info", "File Location Info") if self["has_description"].value: yield LnkString(self, "description") if self["has_rel_path"].value: yield LnkString(self, "relative_path", "Relative path to target") if self["has_working_dir"].value: yield LnkString(self, "working_dir", "Working directory (dir to start target in)") if self["has_cmd_line_args"].value: yield LnkString(self, "cmd_line_args", "Command Line Arguments") if self["has_custom_icon"].value: yield LnkString(self, "custom_icon", "Custom Icon Path") while not self.eof: yield ExtraInfo(self, "extra_info[]")
23,375
Python
.py
520
35.661538
155
0.605054
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,680
pcf.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/pcf.pyc
—Ú Œ »Mc@s,dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZddklZlZddklZlZlZddklZdefdÑÉYZd efd ÑÉYZd efd ÑÉYZd efdÑÉYZdefdÑÉYZdefdÑÉYZdS(sÁ X11 Portable Compiled Font (pcf) parser. Documents: - Format for X11 pcf bitmap font files http://fontforge.sourceforge.net/pcf-format.html (file is based on the X11 sources) Author: Victor Stinner Creation date: 2007-03-20 iˇˇˇˇ(tParser( tFieldSettEnumtUInt8tUInt32tBytestRawBytest NullBytestBittBitst PaddingBitstCString(t LITTLE_ENDIANt BIG_ENDIAN(t textHandlert hexadecimaltfilesizeHandler(t paddingSizetTOCcBszeZh dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6Zhdd6dd6dd6ZdÑZdÑZRS(t Propertiesit AcceleratorsitMetricsitBitmapsis Ink metricsis BDF encodingsi tSWidthsi@s Glyph namesiÄsBDF acceleratorsitDefaultis Ink boundsisAccelerator W ink boundsccsNtt|dÉ|iÉVt|dÉVtt|dÉÉVt|dÉVdS(Nttypetformattsizetoffset(RRt TYPE_NAMER(tself((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyt createFields)scCs&d|di|di|difS(Ns %s at %s (%s)RRR(tdisplaytvalue(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pytcreateDescription/s(t__name__t __module__Rt FORMAT_NAMERR"(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRs    tPropertiesFormatcBseZdZeZdÑZRS(i ccs\t|ddÉVt|dÉVt|dÉVt|ddÉVtt|ddÉtÉVdS(Ns reserved[]itbyte_big_endiantbit_big_endiant scan_uniti(R RRR R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR6s (R#R$t static_sizeR tendianR(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR&3stPropertycBseZdÑZdÑZRS(ccs.t|dÉVt|dÉVt|dÉVdS(Nt name_offsett is_stringt value_offset(RR(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR>scCs |d|idi}d|S(Ns ../name[%s]is Property %s(tindexR!(Rtname((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR"Cs(R#R$RR"(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR,=s t GlyphNamescBseZddÑZdÑZRS(cCsMti||||d|É||_|dio t|_n t|_dS(NRsformat/byte_big_endian(Rt__init__ttocR!R R+R (RtparentR1R4t descriptionR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR3Is   ccsˇt|dÉVt|dÉVg}x?t|diÉD]*}t|dÉ}|V|i|iÉq6Wt|dÉV|iÉ|id}x?|D]7}|i||É}|o |Vnt|dÉVqêW|i |id}|ot |d|ÉVndS(NRtcountsoffset[]ttotal_str_lengthisname[]t end_padding( R&RtxrangeR!tappendtsortt current_sizetseekByteR RR(RtoffsetsR0Rtoffset0tpadding((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRQs(   N(R#R$tNoneR3R(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyR2Hs RcBseZdÑZRS(ccsrt|dÉVt|dÉVg}x<t|diÉD]'}t|dÉ}|V|i|Éq6Wt|iddÉ}|ot|d|ÉVnt|dÉV|i dd ÑÉ|id}xz|D]r}|i ||d iÉ}|o |Vnt |d d |i ÉV|d iot |dd|i ÉVq»q»W|i |id}|ot|d|ÉVndS(NRtnb_props property[]iiRAR8tkeycSs |diS(R-(R!(tentry((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyt<lambda>rsR-sname[]s Name of %sR.svalue[]s Value of %sR9(R&RR:R!R,R;RR=RR<R>R R1R(Rt propertiesR0tpropertyRAR@((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRfs2   (R#R$R(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRestPcfFilecBs_eZdZhdd6dd6dd6edffd6dd 6d d 6ZeZd ÑZd ÑZRS(sfcptpcftidtmisctcategorytfile_extitmagici tmin_sizes X11 Portable Compiled Font (pcf)R6cCs |di|ijodStS(Nt signaturesInvalid signature(R!tMAGICtTrue(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pytvalidateãsc csüt|dddÉVt|dÉVg}x<t|diÉD]'}t|dÉ}|V|i|Éq<W|iddÑÉx|D]}|di}|i|d iÉ}|o |Vn|i|i d }||jo'|i d |i ||fÉ|}n|pqÅn|d id jo"t |d|dd|d ÉVqÅ|d idjo"t |d|dd|d ÉVqÅt|d|d|i ÉVqÅWdS(NRQisFile signature ("\1pcf")tnb_tocstoc[]RDcSs |diS(R(R!(RE((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRFòsRRis+Truncate content of %s to %s bytes (was %s)RiRGRiÄt glyph_namess Glyph namessdata[]s Content of %s(RRR:R!RR;R<R>RR=twarningtpathRR2R(RtentriesR0RERRAtmaxsize((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRês4    ""(RJ(R#R$RRt PARSER_TAGSR R+RTR(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyRIs  N(t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R thachoir_core.endianR R thachoir_core.text_handlerRRRthachoir_core.toolsRRR&R,R2RRI(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pcf.pyt<module> sL  
7,785
Python
.py
42
184.214286
845
0.435417
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,681
pdf.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/pdf.py
""" Adobe Portable Document Format (PDF) parser. Author: Christophe Gisquet <christophe.gisquet@free.fr> """ from hachoir_parser import Parser from hachoir_core.field import ( Field, FieldSet, ParserError, GenericVector, UInt8, UInt16, UInt32, String, RawBytes) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal MAGIC = "%PDF-" ENDMAGIC = "%%EOF" def getLineEnd(s, pos=None): if pos == None: pos = (s.absolute_address+s.current_size)//8 end = s.stream.searchBytesLength("\x0D", False, 8*pos) other_end = s.stream.searchBytesLength("\x0A", False, 8*pos) if end == None or (other_end != None and other_end < end): return other_end return end # TODO: rewrite to account for all possible terminations: ' ', '/', '\0XD' # But this probably requires changing *ALL* of the places they are used, # as ' ' is swallowed but not the others def getElementEnd(s, limit=' ', offset=0): addr = s.absolute_address+s.current_size addr += 8*offset pos = s.stream.searchBytesLength(limit, True, addr) if pos == None: #s.info("Can't find '%s' starting at %u" % (limit, addr)) return None return pos class PDFNumber(Field): LIMITS = ['[', '/', '\x0D', ']'] """ sprintf("%i") or sprinf("%.?f") """ def __init__(self, parent, name, desc=None): Field.__init__(self, parent, name, description=desc) # Get size size = getElementEnd(parent) for limit in self.LIMITS: other_size = getElementEnd(parent, limit) if other_size != None: other_size -= 1 if size == None or other_size < size: size = other_size self._size = 8*size # Get value val = parent.stream.readBytes(self.absolute_address, size) self.info("Number: size=%u value='%s'" % (size, val)) if val.find('.') != -1: self.createValue = lambda: float(val) else: self.createValue = lambda: int(val) class PDFString(Field): """ A string of the shape: ( This string \ uses 3 lines \ with the CR(LF) inhibited ) """ def __init__(self, parent, name, desc=None): Field.__init__(self, parent, name, description=desc) val = "" count = 1 off = 1 while not parent.eof: char = parent.stream.readBytes(self.absolute_address+8*off, 1) # Non-ASCII if not char.isalpha() or char == '\\': off += 1 continue if char == '(': count += 1 if char == ')': count -= 1 # Parenthesis block = 0 => end of string if count == 0: off += 1 break # Add it to the string val += char self._size = 8*off self.createValue = lambda: val class PDFName(Field): LIMITS = ['[', '/', '<', ']'] """ String starting with '/', where characters may be written using their ASCII code (exemple: '#20' would be ' ' ' ', ']' and '\0' are supposed not to be part of the name """ def __init__(self, parent, name, desc=None): Field.__init__(self, parent, name, description=desc) if parent.stream.readBytes(self.absolute_address, 1) != '/': raise ParserError("Unknown PDFName '%s'" % parent.stream.readBytes(self.absolute_address, 10)) size = getElementEnd(parent, offset=1) #other_size = getElementEnd(parent, '[')-1 #if size == None or (other_size != None and other_size < size): # size = other_size for limit in self.LIMITS: other_size = getElementEnd(parent, limit, 1) if other_size != None: other_size -= 1 if size == None or other_size < size: #self.info("New size: %u" % other_size) size = other_size self._size = 8*(size+1) # Value should be without the initial '/' and final ' ' self.createValue = lambda: parent.stream.readBytes(self.absolute_address+8, size).strip(' ') class PDFID(Field): """ Not described as an object, but let's do as it was. This ID has the shape <hexadecimal ASCII string> """ def __init__(self, parent, name, desc=None): Field.__init__(self, parent, name, description=desc) self._size = 8*getElementEnd(parent, '>') self.createValue = lambda: parent.stream.readBytes(self.absolute_address+8, (self._size//8)-1) class NotABool(Exception): pass class PDFBool(Field): """ "true" or "false" string standing for the boolean value """ def __init__(self, parent, name, desc=None): Field.__init__(self, parent, name, description=desc) if parent.stream.readBytes(self.absolute_address, 4) == "true": self._size = 4 self.createValue = lambda: True elif parent.stream.readBytes(self.absolute_address, 5) == "false": self._size = 5 self.createValue = lambda: False raise NotABool class LineEnd(FieldSet): """ Made of 0x0A, 0x0D (we may include several line ends) """ def createFields(self): while not self.eof: addr = self.absolute_address+self.current_size char = self.stream.readBytes(addr, 1) if char == '\x0A': yield UInt8(self, "lf", "Line feed") elif char == '\x0D': yield UInt8(self, "cr", "Line feed") else: self.info("Line ends at %u/%u, len %u" % (addr, self.stream._size, self.current_size)) break class PDFDictionaryPair(FieldSet): def createFields(self): yield PDFName(self, "name", getElementEnd(self)) for field in parsePDFType(self): yield field class PDFDictionary(FieldSet): def createFields(self): yield String(self, "dict_start", 2) while not self.eof: addr = self.absolute_address+self.current_size if self.stream.readBytes(addr, 2) != '>>': for field in parsePDFType(self): yield field else: break yield String(self, "dict_end", 2) class PDFArray(FieldSet): """ Array of possibly non-homogeneous elements, starting with '[' and ending with ']' """ def createFields(self): yield String(self, "array_start", 1) while self.stream.readBytes(self.absolute_address+self.current_size, 1) != ']': for field in parsePDFType(self): yield field yield String(self, "array_end", 1) def parsePDFType(s): addr = s.absolute_address+s.current_size char = s.stream.readBytes(addr, 1) if char == '/': yield PDFName(s, "type[]", getElementEnd(s)) elif char == '<': if s.stream.readBytes(addr+8, 1) == '<': yield PDFDictionary(s, "dict[]") else: yield PDFID(s, "id[]") elif char == '(': yield PDFString(s, "string[]") elif char == '[': yield PDFArray(s, "array[]") else: # First parse size size = getElementEnd(s) for limit in ['/', '>', '<']: other_size = getElementEnd(s, limit) if other_size != None: other_size -= 1 if size == None or (other_size>0 and other_size < size): size = other_size # Get element name = s.stream.readBytes(addr, size) char = s.stream.readBytes(addr+8*size+8, 1) if name.count(' ') > 1 and char == '<': # Probably a catalog yield Catalog(s, "catalog[]") elif name[0] in ('.','-','+', '0', '1', '2', '3', \ '4', '5', '6', '7', '8', '9'): s.info("Not a catalog: %u spaces and end='%s'" % (name.count(' '), char)) yield PDFNumber(s, "integer[]") else: s.info("Trying to parse '%s': %u bytes" % \ (s.stream.readBytes(s.absolute_address+s.current_size, 4), size)) yield String(s, "unknown[]", size) class Header(FieldSet): def createFields(self): yield String(self, "marker", 5, MAGIC) length = getLineEnd(self, 4) if length != None: #self.info("Found at position %08X" % len) yield String(self, "version", length-1) yield LineEnd(self, "line_end") else: self.warning("Can't determine version!") def createDescription(self): return "PDF version %s" % self["version"].display class Body(FieldSet): def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) pos = self.stream.searchBytesLength(CrossReferenceTable.MAGIC, False) if pos == None: raise ParserError("Can't find xref starting at %u" % (self.absolute_address//8)) self._size = 8*pos-self.absolute_address def createFields(self): while self.stream.readBytes(self.absolute_address+self.current_size, 1) == '%': size = getLineEnd(self, 4) if size == 2: yield textHandler(UInt16(self, "crc32"), hexadecimal) elif size == 4: yield textHandler(UInt32(self, "crc32"), hexadecimal) elif self.stream.readBytes(self.absolute_address+self.current_size, size).isalpha(): yield String(self, "comment[]", size) else: RawBytes(self, "unknown_data[]", size) yield LineEnd(self, "line_end[]") #abs_offset = self.current_size//8 # TODO: yield objects that read offsets and deduce size from # "/cross_ref_table/sub_section[]/entries/item[]" offsets = [] for subsection in self.array("/cross_ref_table/sub_section"): for obj in subsection.array("entries/item"): if "byte_offset" in obj: # Could be inserted already sorted offsets.append(obj["byte_offset"].value) offsets.append(self["/cross_ref_table"].absolute_address//8) offsets.sort() for index in xrange(len(offsets)-1): yield Catalog(self, "object[]", size=offsets[index+1]-offsets[index]) class Entry(FieldSet): static_size = 20*8 def createFields(self): typ = self.stream.readBytes(self.absolute_address+17*8, 1) if typ == 'n': yield PDFNumber(self, "byte_offset") elif typ == 'f': yield PDFNumber(self, "next_free_object_number") else: yield PDFNumber(self, "unknown_string") yield PDFNumber(self, "generation_number") yield UInt8(self, "type") yield LineEnd(self, "line_end") def createDescription(self): if self["type"].value == 'n': return "In-use entry at offset %u" % int(self["byte_offset"].value) elif self["type"].value == 'f': return "Free entry before in-use object %u" % \ int(self["next_free_object_number"].value) else: return "unknown %s" % self["unknown_string"].value class SubSection(FieldSet): def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, desc) self.info("Got entry count: '%s'" % self["entry_count"].value) self._size = self.current_size + 8*20*int(self["entry_count"].value) \ + self["line_end"].size def createFields(self): yield PDFNumber(self, "start_number", "Object number of first entry in subsection") self.info("start_number = %i" % self["start_number"].value) yield PDFNumber(self, "entry_count", "Number of entries in subsection") self.info("entry_count = %i" % self["entry_count"].value) yield LineEnd(self, "line_end") yield GenericVector(self, "entries", int(self["entry_count"].value), Entry) #yield LineEnd(self, "line_end[]") def createDescription(self): return "Subsection with %s elements, starting at %s" % \ (self["entry_count"].value, self["start_number"]) class CrossReferenceTable(FieldSet): MAGIC = "xref" def __init__(self, parent, name, desc=None): FieldSet.__init__(self, parent, name, description=desc) pos = self.stream.searchBytesLength(Trailer.MAGIC, False) if pos == None: raise ParserError("Can't find '%s' starting at %u" \ (Trailer.MAGIC, self.absolute_address//8)) self._size = 8*pos-self.absolute_address def createFields(self): yield RawBytes(self, "marker", len(self.MAGIC)) yield LineEnd(self, "line_end[]") while not self.eof: yield SubSection(self, "sub_section[]") class Catalog(FieldSet): END_NAME = ['<', '/', '['] def __init__(self, parent, name, size=None, desc=None): FieldSet.__init__(self, parent, name, description=desc) if size != None: self._size = 8*size # object catalogs are ended with "obj" elif self["object"].value == "obj": size = self.stream.searchBytesLength("endobj", False) if size != None: self._size = 8*(size+2) def createFields(self): yield PDFNumber(self, "index") yield PDFNumber(self, "unknown[]") length = getElementEnd(self) for limit in self.END_NAME: new_length = getElementEnd(self, limit)-len(limit) if length == None or (new_length != None and new_length < length): length = new_length yield String(self, "object", length, strip=' ') if self.stream.readBytes(self.absolute_address+self.current_size, 2) == '<<': yield PDFDictionary(self, "key_list") # End of catalog: this one has "endobj" if self["object"].value == "obj": yield LineEnd(self, "line_end[]") yield String(self, "end_object", len("endobj")) yield LineEnd(self, "line_end[]") class Trailer(FieldSet): MAGIC = "trailer" def createFields(self): yield RawBytes(self, "marker", len(self.MAGIC)) yield LineEnd(self, "line_end[]") yield String(self, "start_attribute_marker", 2) addr = self.absolute_address + self.current_size while self.stream.readBytes(addr, 2) != '>>': t = PDFName(self, "type[]") yield t name = t.value self.info("Parsing PDFName '%s'" % name) if name == "Size": yield PDFNumber(self, "size", "Entries in the file cross-reference section") elif name == "Prev": yield PDFNumber(self, "offset") elif name == "Root": yield Catalog(self, "object_catalog") elif name == "Info": yield Catalog(self, "info") elif name == "ID": yield PDFArray(self, "id") elif name == "Encrypt": yield PDFDictionary(self, "decrypt") else: raise ParserError("Don't know trailer type '%s'" % name) addr = self.absolute_address + self.current_size yield String(self, "end_attribute_marker", 2) yield LineEnd(self, "line_end[]") yield String(self, "start_xref", 9) yield LineEnd(self, "line_end[]") yield PDFNumber(self, "cross_ref_table_start_address") yield LineEnd(self, "line_end[]") yield String(self, "end_marker", len(ENDMAGIC)) yield LineEnd(self, "line_end[]") class PDFDocument(Parser): endian = LITTLE_ENDIAN PARSER_TAGS = { "id": "pdf", "category": "misc", "file_ext": ("pdf",), "mime": (u"application/pdf",), "min_size": (5+4)*8, "magic": ((MAGIC, 5),), "description": "Portable Document Format (PDF) document" } def validate(self): if self.stream.readBytes(0, len(MAGIC)) != MAGIC: return "Invalid magic string" return True # Size is not always determined by position of "%%EOF": # - updated documents have several of those # - PDF files should be parsed from *end* # => TODO: find when a document has been updated def createFields(self): yield Header(self, "header") yield Body(self, "body") yield CrossReferenceTable(self, "cross_ref_table") yield Trailer(self, "trailer")
16,790
Python
.py
402
32.08209
102
0.568755
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,682
ttf.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/ttf.py
""" TrueType Font parser. Documents: - "An Introduction to TrueType Fonts: A look inside the TTF format" written by "NRSI: Computers & Writing Systems" http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=IWS-Chapter08 Author: Victor Stinner Creation date: 2007-02-08 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, UInt16, UInt32, Bit, Bits, PaddingBits, NullBytes, String, RawBytes, Bytes, Enum, TimestampMac32) from hachoir_core.endian import BIG_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal, filesizeHandler MAX_NAME_COUNT = 300 MIN_NB_TABLE = 3 MAX_NB_TABLE = 30 DIRECTION_NAME = { 0: u"Mixed directional", 1: u"Left to right", 2: u"Left to right + neutrals", -1: u"Right to left", -2: u"Right to left + neutrals", } NAMEID_NAME = { 0: u"Copyright notice", 1: u"Font family name", 2: u"Font subfamily name", 3: u"Unique font identifier", 4: u"Full font name", 5: u"Version string", 6: u"Postscript name", 7: u"Trademark", 8: u"Manufacturer name", 9: u"Designer", 10: u"Description", 11: u"URL Vendor", 12: u"URL Designer", 13: u"License Description", 14: u"License info URL", 16: u"Preferred Family", 17: u"Preferred Subfamily", 18: u"Compatible Full", 19: u"Sample text", 20: u"PostScript CID findfont name", } PLATFORM_NAME = { 0: "Unicode", 1: "Macintosh", 2: "ISO", 3: "Microsoft", 4: "Custom", } CHARSET_MAP = { # (platform, encoding) => charset 0: {3: "UTF-16-BE"}, 1: {0: "MacRoman"}, 3: {1: "UTF-16-BE"}, } class TableHeader(FieldSet): def createFields(self): yield String(self, "tag", 4) yield textHandler(UInt32(self, "checksum"), hexadecimal) yield UInt32(self, "offset") yield filesizeHandler(UInt32(self, "size")) def createDescription(self): return "Table entry: %s (%s)" % (self["tag"].display, self["size"].display) class NameHeader(FieldSet): def createFields(self): yield Enum(UInt16(self, "platformID"), PLATFORM_NAME) yield UInt16(self, "encodingID") yield UInt16(self, "languageID") yield Enum(UInt16(self, "nameID"), NAMEID_NAME) yield UInt16(self, "length") yield UInt16(self, "offset") def getCharset(self): platform = self["platformID"].value encoding = self["encodingID"].value try: return CHARSET_MAP[platform][encoding] except KeyError: self.warning("TTF: Unknown charset (%s,%s)" % (platform, encoding)) return "ISO-8859-1" def createDescription(self): platform = self["platformID"].display name = self["nameID"].display return "Name record: %s (%s)" % (name, platform) def parseFontHeader(self): yield UInt16(self, "maj_ver", "Major version") yield UInt16(self, "min_ver", "Minor version") yield UInt16(self, "font_maj_ver", "Font major version") yield UInt16(self, "font_min_ver", "Font minor version") yield textHandler(UInt32(self, "checksum"), hexadecimal) yield Bytes(self, "magic", 4, r"Magic string (\x5F\x0F\x3C\xF5)") if self["magic"].value != "\x5F\x0F\x3C\xF5": raise ParserError("TTF: invalid magic of font header") # Flags yield Bit(self, "y0", "Baseline at y=0") yield Bit(self, "x0", "Left sidebearing point at x=0") yield Bit(self, "instr_point", "Instructions may depend on point size") yield Bit(self, "ppem", "Force PPEM to integer values for all") yield Bit(self, "instr_width", "Instructions may alter advance width") yield Bit(self, "vertical", "e laid out vertically?") yield PaddingBits(self, "reserved[]", 1) yield Bit(self, "linguistic", "Requires layout for correct linguistic rendering?") yield Bit(self, "gx", "Metamorphosis effects?") yield Bit(self, "strong", "Contains strong right-to-left glyphs?") yield Bit(self, "indic", "contains Indic-style rearrangement effects?") yield Bit(self, "lossless", "Data is lossless (Agfa MicroType compression)") yield Bit(self, "converted", "Font converted (produce compatible metrics)") yield Bit(self, "cleartype", "Optimised for ClearType") yield Bits(self, "adobe", 2, "(used by Adobe)") yield UInt16(self, "unit_per_em", "Units per em") if not(16 <= self["unit_per_em"].value <= 16384): raise ParserError("TTF: Invalid unit/em value") yield UInt32(self, "created_high") yield TimestampMac32(self, "created") yield UInt32(self, "modified_high") yield TimestampMac32(self, "modified") yield UInt16(self, "xmin") yield UInt16(self, "ymin") yield UInt16(self, "xmax") yield UInt16(self, "ymax") # Mac style yield Bit(self, "bold") yield Bit(self, "italic") yield Bit(self, "underline") yield Bit(self, "outline") yield Bit(self, "shadow") yield Bit(self, "condensed", "(narrow)") yield Bit(self, "expanded") yield PaddingBits(self, "reserved[]", 9) yield UInt16(self, "lowest", "Smallest readable size in pixels") yield Enum(UInt16(self, "font_dir", "Font direction hint"), DIRECTION_NAME) yield Enum(UInt16(self, "ofst_format"), {0: "short offsets", 1: "long"}) yield UInt16(self, "glyph_format", "(=0)") def parseNames(self): # Read header yield UInt16(self, "format") if self["format"].value != 0: raise ParserError("TTF (names): Invalid format (%u)" % self["format"].value) yield UInt16(self, "count") yield UInt16(self, "offset") if MAX_NAME_COUNT < self["count"].value: raise ParserError("Invalid number of names (%s)" % self["count"].value) # Read name index entries = [] for index in xrange(self["count"].value): entry = NameHeader(self, "header[]") yield entry entries.append(entry) # Sort names by their offset entries.sort(key=lambda field: field["offset"].value) # Read name value last = None for entry in entries: # Skip duplicates values new = (entry["offset"].value, entry["length"].value) if last and last == new: self.warning("Skip duplicate %s %s" % (entry.name, new)) continue last = (entry["offset"].value, entry["length"].value) # Skip negative offset offset = entry["offset"].value + self["offset"].value if offset < self.current_size//8: self.warning("Skip value %s (negative offset)" % entry.name) continue # Add padding if any padding = self.seekByte(offset, relative=True, null=True) if padding: yield padding # Read value size = entry["length"].value if size: yield String(self, "value[]", size, entry.description, charset=entry.getCharset()) padding = (self.size - self.current_size) // 8 if padding: yield NullBytes(self, "padding_end", padding) class Table(FieldSet): TAG_INFO = { "head": ("header", "Font header", parseFontHeader), "name": ("names", "Names", parseNames), } def __init__(self, parent, name, table, **kw): FieldSet.__init__(self, parent, name, **kw) self.table = table tag = table["tag"].value if tag in self.TAG_INFO: self._name, self._description, self.parser = self.TAG_INFO[tag] else: self.parser = None def createFields(self): if self.parser: for field in self.parser(self): yield field else: yield RawBytes(self, "content", self.size//8) def createDescription(self): return "Table %s (%s)" % (self.table["tag"].value, self.table.path) class TrueTypeFontFile(Parser): endian = BIG_ENDIAN PARSER_TAGS = { "id": "ttf", "category": "misc", "file_ext": ("ttf",), "min_size": 10*8, # FIXME "description": "TrueType font", } def validate(self): if self["maj_ver"].value != 1: return "Invalid major version (%u)" % self["maj_ver"].value if self["min_ver"].value != 0: return "Invalid minor version (%u)" % self["min_ver"].value if not (MIN_NB_TABLE <= self["nb_table"].value <= MAX_NB_TABLE): return "Invalid number of table (%u)" % self["nb_table"].value return True def createFields(self): yield UInt16(self, "maj_ver", "Major version") yield UInt16(self, "min_ver", "Minor version") yield UInt16(self, "nb_table") yield UInt16(self, "search_range") yield UInt16(self, "entry_selector") yield UInt16(self, "range_shift") tables = [] for index in xrange(self["nb_table"].value): table = TableHeader(self, "table_hdr[]") yield table tables.append(table) tables.sort(key=lambda field: field["offset"].value) for table in tables: padding = self.seekByte(table["offset"].value, null=True) if padding: yield padding size = table["size"].value if size: yield Table(self, "table[]", table, size=size*8) padding = self.seekBit(self.size, null=True) if padding: yield padding
9,417
Python
.py
243
31.917695
94
0.62407
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,683
chm.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/chm.py
""" InfoTech Storage Format (ITSF) parser, used by Microsoft's HTML Help (.chm) Document: - Microsoft's HTML Help (.chm) format http://www.wotsit.org (search "chm") - chmlib library http://www.jedrea.com/chmlib/ Author: Victor Stinner Creation date: 2007-03-04 """ from hachoir_parser import Parser from hachoir_core.field import (Field, FieldSet, ParserError, Int32, UInt32, UInt64, RawBytes, PaddingBytes, Enum, String) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_parser.common.win32 import GUID from hachoir_parser.common.win32_lang_id import LANGUAGE_ID from hachoir_core.text_handler import textHandler, hexadecimal, filesizeHandler class CWord(Field): """ Compressed double-word """ def __init__(self, parent, name, description=None): Field.__init__(self, parent, name, 8, description) endian = self._parent.endian stream = self._parent.stream addr = self.absolute_address value = 0 byte = stream.readBits(addr, 8, endian) while byte & 0x80: value <<= 7 value += (byte & 0x7f) self._size += 8 if 64 < self._size: raise ParserError("CHM: CWord is limited to 64 bits") addr += 8 byte = stream.readBits(addr, 8, endian) value += byte self.createValue = lambda: value class Filesize_Header(FieldSet): def createFields(self): yield textHandler(UInt32(self, "unknown[]", "0x01FE"), hexadecimal) yield textHandler(UInt32(self, "unknown[]", "0x0"), hexadecimal) yield filesizeHandler(UInt64(self, "file_size")) yield textHandler(UInt32(self, "unknown[]", "0x0"), hexadecimal) yield textHandler(UInt32(self, "unknown[]", "0x0"), hexadecimal) class ITSP(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["size"].value * 8 def createFields(self): yield String(self, "magic", 4, "ITSP", charset="ASCII") yield UInt32(self, "version", "Version (=1)") yield filesizeHandler(UInt32(self, "size", "Length (in bytes) of the directory header (84)")) yield UInt32(self, "unknown[]", "(=10)") yield filesizeHandler(UInt32(self, "block_size", "Directory block size")) yield UInt32(self, "density", "Density of quickref section, usually 2") yield UInt32(self, "index_depth", "Depth of the index tree") yield Int32(self, "nb_dir", "Chunk number of root index chunk") yield UInt32(self, "first_pmgl", "Chunk number of first PMGL (listing) chunk") yield UInt32(self, "last_pmgl", "Chunk number of last PMGL (listing) chunk") yield Int32(self, "unknown[]", "-1") yield UInt32(self, "nb_dir_chunk", "Number of directory chunks (total)") yield Enum(UInt32(self, "lang_id", "Windows language ID"), LANGUAGE_ID) yield GUID(self, "system_uuid", "{5D02926A-212E-11D0-9DF9-00A0C922E6EC}") yield filesizeHandler(UInt32(self, "size2", "Same value than size")) yield Int32(self, "unknown[]", "-1") yield Int32(self, "unknown[]", "-1") yield Int32(self, "unknown[]", "-1") class ITSF(FieldSet): def createFields(self): yield String(self, "magic", 4, "ITSF", charset="ASCII") yield UInt32(self, "version") yield UInt32(self, "header_size", "Total header length (in bytes)") yield UInt32(self, "one") yield UInt32(self, "last_modified") yield Enum(UInt32(self, "lang_id", "Windows Language ID"), LANGUAGE_ID) yield GUID(self, "dir_uuid", "{7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC}") yield GUID(self, "stream_uuid", "{7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC}") yield UInt64(self, "filesize_offset") yield filesizeHandler(UInt64(self, "filesize_len")) yield UInt64(self, "dir_offset") yield filesizeHandler(UInt64(self, "dir_len")) if 3 <= self["version"].value: yield UInt64(self, "data_offset") class PMGL_Entry(FieldSet): def createFields(self): yield CWord(self, "name_len") yield String(self, "name", self["name_len"].value, charset="UTF-8") yield CWord(self, "space") yield CWord(self, "start") yield filesizeHandler(CWord(self, "length")) def createDescription(self): return "%s (%s)" % (self["name"].value, self["length"].display) class PMGL(FieldSet): def createFields(self): # Header yield String(self, "magic", 4, "PMGL", charset="ASCII") yield filesizeHandler(Int32(self, "free_space", "Length of free space and/or quickref area at end of directory chunk")) yield Int32(self, "unknown") yield Int32(self, "previous", "Chunk number of previous listing chunk") yield Int32(self, "next", "Chunk number of previous listing chunk") # Entries stop = self.size - self["free_space"].value * 8 while self.current_size < stop: yield PMGL_Entry(self, "entry[]") # Padding padding = (self.size - self.current_size) // 8 if padding: yield PaddingBytes(self, "padding", padding) class PMGI_Entry(FieldSet): def createFields(self): yield CWord(self, "name_len") yield String(self, "name", self["name_len"].value, charset="UTF-8") yield CWord(self, "page") def createDescription(self): return "%s (page #%u)" % (self["name"].value, self["page"].value) class PMGI(FieldSet): def createFields(self): yield String(self, "magic", 4, "PMGI", charset="ASCII") yield filesizeHandler(UInt32(self, "free_space", "Length of free space and/or quickref area at end of directory chunk")) stop = self.size - self["free_space"].value * 8 while self.current_size < stop: yield PMGI_Entry(self, "entry[]") padding = (self.size - self.current_size) // 8 if padding: yield PaddingBytes(self, "padding", padding) class Directory(FieldSet): def createFields(self): yield ITSP(self, "itsp") block_size = self["itsp/block_size"].value * 8 nb_dir = self["itsp/nb_dir"].value if nb_dir < 0: nb_dir = 1 for index in xrange(nb_dir): yield PMGL(self, "pmgl[]", size=block_size) if self.current_size < self.size: yield PMGI(self, "pmgi", size=block_size) class ChmFile(Parser): PARSER_TAGS = { "id": "chm", "category": "misc", "file_ext": ("chm",), "min_size": 4*8, "magic": (("ITSF\3\0\0\0", 0),), "description": "Microsoft's HTML Help (.chm)", } endian = LITTLE_ENDIAN def validate(self): if self.stream.readBytes(0, 4) != "ITSF": return "Invalid magic" if self["itsf/version"].value != 3: return "Invalid version" return True def createFields(self): yield ITSF(self, "itsf") yield Filesize_Header(self, "file_size", size=self["itsf/filesize_len"].value*8) padding = self.seekByte(self["itsf/dir_offset"].value) if padding: yield padding yield Directory(self, "dir", size=self["itsf/dir_len"].value*8) size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "raw_end", size) def createContentSize(self): return self["file_size/file_size"].value * 8
7,522
Python
.py
169
36.579882
101
0.622917
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,684
word_doc.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/word_doc.py
""" Documents: * libwx source code: see fib.c source code * "Microsoft Word 97 Binary File Format" http://bio.gsi.de/DOCS/AIX/wword8.html Microsoft Word 97 (aka Version 8) for Windows and Macintosh. From the Office book, found in the Microsoft Office Development section in the MSDN Online Library. HTMLified June 1998. Revised Aug 1 1998, added missing Definitions section. Revised Dec 21 1998, added missing Document Properties (section). """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Bit, Bits, UInt8, Int16, UInt16, UInt32, Int32, NullBytes, Bytes, RawBytes, PascalString16, DateTimeMSDOS32, TimeDateMSDOS32) from hachoir_core.endian import LITTLE_ENDIAN #TIMESTAMP = TimeDateMSDOS32 TIMESTAMP = DateTimeMSDOS32 class BaseWordDocument: def createFields(self): yield UInt16(self, "wIdent", 2) yield UInt16(self, "nFib") yield UInt16(self, "nProduct") yield UInt16(self, "lid") yield Int16(self, "pnNext") yield Bit(self, "fDot") yield Bit(self, "fGlsy") yield Bit(self, "fComplex") yield Bit(self, "fHasPic") yield Bits(self, "cQuickSaves", 4) yield Bit(self, "fEncrypted") yield Bit(self, "fWhichTblStm") yield Bit(self, "fReadOnlyRecommanded") yield Bit(self, "fWriteReservation") yield Bit(self, "fExtChar") yield Bit(self, "fLoadOverride") yield Bit(self, "fFarEeast") yield Bit(self, "fCrypto") yield UInt16(self, "nFibBack") yield UInt32(self, "lKey") yield UInt8(self, "envr") yield Bit(self, "fMac") yield Bit(self, "fEmptySpecial") yield Bit(self, "fLoadOverridePage") yield Bit(self, "fFutureSavedUndo") yield Bit(self, "fWord97Save") yield Bits(self, "fSpare0", 3) yield UInt16(self, "chse") yield UInt16(self, "chsTables") yield UInt32(self, "fcMin") yield UInt32(self, "fcMac") yield PascalString16(self, "file_creator", strip="\0") yield NullBytes(self, "reserved[]", 12) yield Int16(self, "lidFE") yield UInt16(self, "clw") yield Int32(self, "cbMac") yield UInt32(self, "lProductCreated") yield TIMESTAMP(self, "lProductRevised") yield UInt32(self, "ccpText") yield Int32(self, "ccpFtn") yield Int32(self, "ccpHdr") yield Int32(self, "ccpMcr") yield Int32(self, "ccpAtn") yield Int32(self, "ccpEdn") yield Int32(self, "ccpTxbx") yield Int32(self, "ccpHdrTxbx") yield Int32(self, "pnFbpChpFirst") yield Int32(self, "pnChpFirst") yield Int32(self, "cpnBteChp") yield Int32(self, "pnFbpPapFirst") yield Int32(self, "pnPapFirst") yield Int32(self, "cpnBtePap") yield Int32(self, "pnFbpLvcFirst") yield Int32(self, "pnLvcFirst") yield Int32(self, "cpnBteLvc") yield Int32(self, "fcIslandFirst") yield Int32(self, "fcIslandLim") yield UInt16(self, "cfclcb") yield Int32(self, "fcStshfOrig") yield UInt32(self, "lcbStshfOrig") yield Int32(self, "fcStshf") yield UInt32(self, "lcbStshf") yield Int32(self, "fcPlcffndRef") yield UInt32(self, "lcbPlcffndRef") yield Int32(self, "fcPlcffndTxt") yield UInt32(self, "lcbPlcffndTxt") yield Int32(self, "fcPlcfandRef") yield UInt32(self, "lcbPlcfandRef") yield Int32(self, "fcPlcfandTxt") yield UInt32(self, "lcbPlcfandTxt") yield Int32(self, "fcPlcfsed") yield UInt32(self, "lcbPlcfsed") yield Int32(self, "fcPlcpad") yield UInt32(self, "lcbPlcpad") yield Int32(self, "fcPlcfphe") yield UInt32(self, "lcbPlcfphe") yield Int32(self, "fcSttbfglsy") yield UInt32(self, "lcbSttbfglsy") yield Int32(self, "fcPlcfglsy") yield UInt32(self, "lcbPlcfglsy") yield Int32(self, "fcPlcfhdd") yield UInt32(self, "lcbPlcfhdd") yield Int32(self, "fcPlcfbteChpx") yield UInt32(self, "lcbPlcfbteChpx") yield Int32(self, "fcPlcfbtePapx") yield UInt32(self, "lcbPlcfbtePapx") yield Int32(self, "fcPlcfsea") yield UInt32(self, "lcbPlcfsea") yield Int32(self, "fcSttbfffn") yield UInt32(self, "lcbSttbfffn") yield Int32(self, "fcPlcffldMom") yield UInt32(self, "lcbPlcffldMom") yield Int32(self, "fcPlcffldHdr") yield UInt32(self, "lcbPlcffldHdr") yield Int32(self, "fcPlcffldFtn") yield UInt32(self, "lcbPlcffldFtn") yield Int32(self, "fcPlcffldAtn") yield UInt32(self, "lcbPlcffldAtn") yield Int32(self, "fcPlcffldMcr") yield UInt32(self, "lcbPlcffldMcr") yield Int32(self, "fcSttbfbkmk") yield UInt32(self, "lcbSttbfbkmk") yield Int32(self, "fcPlcfbkf") yield UInt32(self, "lcbPlcfbkf") yield Int32(self, "fcPlcfbkl") yield UInt32(self, "lcbPlcfbkl") yield Int32(self, "fcCmds") yield UInt32(self, "lcbCmds") yield Int32(self, "fcPlcmcr") yield UInt32(self, "lcbPlcmcr") yield Int32(self, "fcSttbfmcr") yield UInt32(self, "lcbSttbfmcr") yield Int32(self, "fcPrDrvr") yield UInt32(self, "lcbPrDrvr") yield Int32(self, "fcPrEnvPort") yield UInt32(self, "lcbPrEnvPort") yield Int32(self, "fcPrEnvLand") yield UInt32(self, "lcbPrEnvLand") yield Int32(self, "fcWss") yield UInt32(self, "lcbWss") yield Int32(self, "fcDop") yield UInt32(self, "lcbDop") yield Int32(self, "fcSttbfAssoc") yield UInt32(self, "lcbSttbfAssoc") yield Int32(self, "fcClx") yield UInt32(self, "lcbClx") yield Int32(self, "fcPlcfpgdFtn") yield UInt32(self, "lcbPlcfpgdFtn") yield Int32(self, "fcAutosaveSource") yield UInt32(self, "lcbAutosaveSource") yield Int32(self, "fcGrpXstAtnOwners") yield UInt32(self, "lcbGrpXstAtnOwners") yield Int32(self, "fcSttbfAtnbkmk") yield UInt32(self, "lcbSttbfAtnbkmk") yield Int32(self, "fcPlcdoaMom") yield UInt32(self, "lcbPlcdoaMom") yield Int32(self, "fcPlcdoaHdr") yield UInt32(self, "lcbPlcdoaHdr") yield Int32(self, "fcPlcspaMom") yield UInt32(self, "lcbPlcspaMom") yield Int32(self, "fcPlcspaHdr") yield UInt32(self, "lcbPlcspaHdr") yield Int32(self, "fcPlcfAtnbkf") yield UInt32(self, "lcbPlcfAtnbkf") yield Int32(self, "fcPlcfAtnbkl") yield UInt32(self, "lcbPlcfAtnbkl") yield Int32(self, "fcPms") yield UInt32(self, "lcbPms") yield Int32(self, "fcFormFldSttbs") yield UInt32(self, "lcbFormFldSttbs") yield Int32(self, "fcPlcfendRef") yield UInt32(self, "lcbPlcfendRef") yield Int32(self, "fcPlcfendTxt") yield UInt32(self, "lcbPlcfendTxt") yield Int32(self, "fcPlcffldEdn") yield UInt32(self, "lcbPlcffldEdn") yield Int32(self, "fcPlcfpgdEdn") yield UInt32(self, "lcbPlcfpgdEdn") yield Int32(self, "fcDggInfo") yield UInt32(self, "lcbDggInfo") yield Int32(self, "fcSttbfRMark") yield UInt32(self, "lcbSttbfRMark") yield Int32(self, "fcSttbCaption") yield UInt32(self, "lcbSttbCaption") yield Int32(self, "fcSttbAutoCaption") yield UInt32(self, "lcbSttbAutoCaption") yield Int32(self, "fcPlcfwkb") yield UInt32(self, "lcbPlcfwkb") yield Int32(self, "fcPlcfspl") yield UInt32(self, "lcbPlcfspl") yield Int32(self, "fcPlcftxbxTxt") yield UInt32(self, "lcbPlcftxbxTxt") yield Int32(self, "fcPlcffldTxbx") yield UInt32(self, "lcbPlcffldTxbx") yield Int32(self, "fcPlcfhdrtxbxTxt") yield UInt32(self, "lcbPlcfhdrtxbxTxt") yield Int32(self, "fcPlcffldHdrTxbx") yield UInt32(self, "lcbPlcffldHdrTxbx") yield Int32(self, "fcStwUser") yield UInt32(self, "lcbStwUser") yield Int32(self, "fcSttbttmbd") yield UInt32(self, "cbSttbttmbd") yield Int32(self, "fcUnused") yield UInt32(self, "lcbUnused") yield Int32(self, "fcPgdMother") yield UInt32(self, "lcbPgdMother") yield Int32(self, "fcBkdMother") yield UInt32(self, "lcbBkdMother") yield Int32(self, "fcPgdFtn") yield UInt32(self, "lcbPgdFtn") yield Int32(self, "fcBkdFtn") yield UInt32(self, "lcbBkdFtn") yield Int32(self, "fcPgdEdn") yield UInt32(self, "lcbPgdEdn") yield Int32(self, "fcBkdEdn") yield UInt32(self, "lcbBkdEdn") yield Int32(self, "fcSttbfIntlFld") yield UInt32(self, "lcbSttbfIntlFld") yield Int32(self, "fcRouteSlip") yield UInt32(self, "lcbRouteSlip") yield Int32(self, "fcSttbSavedBy") yield UInt32(self, "lcbSttbSavedBy") yield Int32(self, "fcSttbFnm") yield UInt32(self, "lcbSttbFnm") yield Int32(self, "fcPlcfLst") yield UInt32(self, "lcbPlcfLst") yield Int32(self, "fcPlfLfo") yield UInt32(self, "lcbPlfLfo") yield Int32(self, "fcPlcftxbxBkd") yield UInt32(self, "lcbPlcftxbxBkd") yield Int32(self, "fcPlcftxbxHdrBkd") yield UInt32(self, "lcbPlcftxbxHdrBkd") yield Int32(self, "fcDocUndo") yield UInt32(self, "lcbDocUndo") yield Int32(self, "fcRgbuse") yield UInt32(self, "lcbRgbuse") yield Int32(self, "fcUsp") yield UInt32(self, "lcbUsp") yield Int32(self, "fcUskf") yield UInt32(self, "lcbUskf") yield Int32(self, "fcPlcupcRgbuse") yield UInt32(self, "lcbPlcupcRgbuse") yield Int32(self, "fcPlcupcUsp") yield UInt32(self, "lcbPlcupcUsp") yield Int32(self, "fcSttbGlsyStyle") yield UInt32(self, "lcbSttbGlsyStyle") yield Int32(self, "fcPlgosl") yield UInt32(self, "lcbPlgosl") yield Int32(self, "fcPlcocx") yield UInt32(self, "lcbPlcocx") yield Int32(self, "fcPlcfbteLvc") yield UInt32(self, "lcbPlcfbteLvc") yield TIMESTAMP(self, "ftModified") yield Int32(self, "fcPlcflvc") yield UInt32(self, "lcbPlcflvc") yield Int32(self, "fcPlcasumy") yield UInt32(self, "lcbPlcasumy") yield Int32(self, "fcPlcfgram") yield UInt32(self, "lcbPlcfgram") yield Int32(self, "fcSttbListNames") yield UInt32(self, "lcbSttbListNames") yield Int32(self, "fcSttbfUssr") yield UInt32(self, "lcbSttbfUssr") tail = (self.size - self.current_size) // 8 if tail: yield RawBytes(self, "tail", tail) class WordDocumentFieldSet(BaseWordDocument, FieldSet): pass class WordDocumentParser(BaseWordDocument, Parser): PARSER_TAGS = { "id": "word_document", "min_size": 8, "description": "Microsoft Office Word document", } endian = LITTLE_ENDIAN def __init__(self, stream, **kw): Parser.__init__(self, stream, **kw) def validate(self): return True
11,361
Python
.py
280
32.107143
79
0.635295
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,685
torrent.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/torrent.pyc
Ñò Î ÈMc @sFdZddklZddklZlZlZlZddkl Z ddk l Z l Z l Z dZdZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZhed6ed6ed6Zx'eddƒD]Zeeeeƒ<q Wd„Zdefd„ƒYZdS(s³ .torrent metainfo file parser http://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Structure Status: To statufy Author: Christophe Gisquet <christophe.gisquet@free.fr> iÿÿÿÿ(tParser(tFieldSett ParserErrortStringtRawBytes(t LITTLE_ENDIAN(t makePrintablet timestampUNIXt humanFilesizeiitIntegercBseZd„Zd„ZRS(ccs·t|dddddƒV|i|i}|iidt||tddƒ}|djotdƒ‚n|ptd ƒ‚nt|d |d ddƒVt|d dd ƒVdS(NtstartisInteger start delimiter (i)tcharsettASCIIteis2Torrent: Unable to find integer end delimiter (e)!sTorrent: error, empty integer!tvalues Integer valuetendsInteger end delimiter( Rtabsolute_addresst current_sizetstreamtsearchBytesLengthtFalsetMAX_INTEGER_SIZEtNoneR(tselftaddrtlen((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyt createFieldss' cCst|diƒS(s)Read integer value (may raise ValueError)R(tintR(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyt createValue&s(t__name__t __module__RR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR s t TorrentStringcBseZd„Zd„ZRS(c csT|i}|iidt||tddƒ}|djotdƒ‚n|ptdƒ‚nt|d|dƒ}|Vyt|i ƒ}Wnt j o d}nX|d jo&td t |i d d t ƒƒ‚nt|d ddƒV|p|i d|ƒdS|djot|d|dddƒVnt|d|dƒVdS(Nt:iis.Torrent: unable to find string separator (':')s!Torrent: error: no string length!tlengths String lengthiÿÿÿÿisInvalid string length (%s)R t to_unicodet separatorsString length/value separatorsEmpty string: len=%iiRs String valueR s ISO-8859-1sRaw data(RRRRtMAX_STRING_LENGTHRRRRRt ValueErrorRtTruetinfoR(RRRtval((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR-s* '   & cCs?d|jo*|d}|itjo|iSdSndSdS(NR(t __class__RRR(Rtfield((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyRFs   (RRRR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR*s t DictionarycBseZd„ZRS(ccsnt|dddddƒVx9|ii|i|idƒdjot|dƒVqWt|ddd ƒVdS( NR isDictionary start delimiter (d)R R R sitem[]RsDictionary end delimiter(RRt readBytesRRtDictionaryItem(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyRRs &(RRR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR+PstListcBseZd„ZRS(ccsht|dddƒVx9|ii|i|idƒdjot|dƒVqWt|dddƒVdS(NR isList start delimiterR sitem[]RsList end delimiter(RRR,RRtEntry(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyRZs &(RRR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR.XsR-cBs5eZd„Zd„Zd„Zd„Zd„ZRS(cGsTti||Œ|d}|iƒpdS|i}t|ƒiddƒ|_dS(Ntkeyt t_(Rt__init__thasValueRtstrtreplacet_name(RtargsR0((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR3as    cCsA|diƒpdS|idjot|iƒSti|ƒS(NRR!t piece_length(slengthR9(R4RR7RRRt createDisplay(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR:ks cCs@|diƒpdS|idjo |iƒS|diSdS(NRt creation_date(R4RR7tcreateTimestampValueR(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyRrs  ccs t|dƒVt|dƒVdS(NR0R(R/(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyRzscCst|diƒS(NR(RR(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR<~s(RRR3R:RRR<(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR-`s    tdtitlii cCs]|i|i}|ii|dƒ}|tjotdtƒ‚nt|}|||ƒS(Nis%Torrent: Entry of type %r not handled(RRRR,tTAGSRttype(tparenttnameRttagtcls((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR/‡s   t TorrentFilecBsfeZeZdZhdd6dd6dd6dd6dd 6ed ffd 6d d6Zd„Zd„ZRS(s d8:announcettorrenttidtmisctcategorytfile_exti2itmin_sizeuapplication/x-bittorrenttmimeitmagicsTorrent metainfo filet descriptioncCs1|iidt|iƒƒ|ijodStS(Nis Invalid magic(RR,RtMAGICR&(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pytvalidateœs(ccst|dd|iƒVdS(Ntroottsize(R+RS(R((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyR¡s(RGi�(uapplication/x-bittorrent(RRRtendianRPt PARSER_TAGSRQR(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyRF�s  Ni (t__doc__thachoir_parserRthachoir_core.fieldRRRRthachoir_core.endianRthachoir_core.toolsRRRR$RR RR+R.R-R@txrangetindexR5R/RF(((sE/pentest/enumeration/google/metagoofil/hachoir_parser/misc/torrent.pyt<module>s""&" 
7,826
Python
.py
34
229.058824
930
0.460275
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,686
file_3ds.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/file_3ds.pyc
Ñò Î ÈMc @s$dZddklZddklZlZlZlZlZl Z l Z ddk l Z ddk lZddklZlZddklZlZd„Zd „Zd „Zd „Zd efd „ƒYZd„Zd„Zd„Zd„Zdefd„ƒYZdefd„ƒYZdS(s: 3D Studio Max file (.3ds) parser. Author: Victor Stinner iÿÿÿÿ(tParser(tStaticFieldSettFieldSettUInt16tUInt32tRawBytestEnumtCString(tRGB(t LITTLE_ENDIAN(t textHandlert hexadecimal(tVertextMapUVccsLt|ddƒV|did}x#|i|jot|dƒVq%WdS(Ntnames Object nametsizeischunk[](Rtvaluet current_sizetChunk(tparentR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyt readObjects ccst|ddƒVdS(NtfilenamesTexture filename(R(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pytreadTextureFilenamesccst|ddƒVdS(Ntversions3DS file format version(R(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyt readVersionsccst|ddƒVdS(NRs Material name(R(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pytreadMaterialNamestPolygoncBs>eZeddfeddfeddfeddffZRS(tasVertex AtbsVertex BtcsVertex CtflagstFlags(t__name__t __module__Rtformat(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyRs   ccsDt|ddƒVx,t|diƒD]}t|ddƒVq%WdS(Ntcounts Map countsmap_uv[]s Mapping UV(RtxrangeRR (Rtindex((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyt readMapList$sccst|dƒVdS(Ntcolor(R(R((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyt readColor)sccsGt|ddƒVx/td|diƒD]}t|ddƒVq(WdS(NR#s Vertex countisvertex[]R (RtrangeRR (RR%((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pytreadVertexList,sccs}t|ddƒ}|Vx(td|iƒD]}t|dƒVq*W|did}x#|i|jot|dƒVqVWdS(NR#s Vertex countis polygon[]Rischunk[](RR)RRRR(RR#tiR((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pytreadPolygonList1sRc BsfeZhdd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36Zh d4d6d5d6d6d6d7d#6d8d6d9d 6d:d 6d;d6d<d6d=d 6Zd@Zhed6ed 6ed!6ed6e d6e d 6e d6e d6Z d>„Zd?„ZRS(AtColoris Main chunkiMMs File versionisMaterials and objectsi==tObjecti@sMesh (triangular)iAs Vertices listiAsPolygon (faces) listi As Map UV listi@AsObject materiali0As New materialiÿ¯s Material namei sMaterial ambienti sMaterial diffusei  sTexture speculari0 tTexturei¢sTexture filenamei£t Keyframesi°sObject node tagi°sLight target node tagi°sSpot light node tagi°sKeyframes headeri °sKeyframe current timei °sNode identifieri0°s Node headeri°sViewport layoutiptmainRtobj_matt keyframess material[]sobject[]t vertices_listt polygon_listt mapuv_listtmeshcGszti||Œd|di|_|di}|tijoti||_nd||_|did|_dS(Ns Chunk: %sttypes chunk_%04xRi( Rt__init__tdisplayt _descriptionRRtchunk_id_by_typet_namet_size(tselftargsR8((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyR9zs  ccsöttt|ddƒtƒtiƒVt|ddƒV|did}|djodS|di}|tijo-xx|i |i jot|dƒVqzWnO|ti jo-ti ||ƒ}x(|D] }|VqÎWnt |d|ƒVdS( NR8s Chunk typeRsChunk size (in bytes)iischunk[]tdata( RR RR Rt type_nameRRt sub_chunksRRthandlersR(R?t content_sizeR8tfieldstfield((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyt createFieldsŠs &   ( iMMiAi==iÿ¯i¢i°i°i°i i0 i  i°(R R!RBR<RCRRRR(RR*R,R&RDR9RH(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyR:sh    tFile3dscBsPeZeZhdd6dd6dd6dd6dd 6d d 6Zd „Zd „ZRS(t3dstidtmisctcategorytfile_extu image/x-3dstmimeiitmin_sizes3D Studio Max modelt descriptioncCs>|iiddƒdjodS|didjodStS( NiitMMsWrong signaturesmain/version/versionisUnknown format version(ii(tstreamt readBytesRtTrue(R?((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pytvalidate§s ccs$x|ipt|dƒVqWdS(Nschunk[](teofR(R?((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyRH®s (RJ(u image/x-3dsi€(R R!R tendiant PARSER_TAGSRVRH(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyRIœs  N( t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRthachoir_parser.image.commonRthachoir_core.endianR thachoir_core.text_handlerR R thachoir_parser.misc.commonR R RRRRRR&R(R*R,RRI(((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/file_3ds.pyt<module>s"4        b
7,254
Python
.py
32
225.6875
1,159
0.466288
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,687
pifv.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/pifv.pyc
Ñò Î ÈMc@sÐdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZddklZddklZlZddklZdZdZd Zd Zd Zd Zd ZdZdZdZ dZ!dZ"dZ#h dde6dde6de6de6de6de6de6de6de6de 6dd e!6d!e"6d"e#6Z$dZ%dZ&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/h d,e%6d-e&6d.d/e'6d0e(6d1e)6d2e*6d3e+6d4e,6d5e-6d6e.6d7e/6Z0x!e1d8d9ƒD]Z2d:e0e2<qWx!e1d9d+ƒD]Z2d;e0e2<q&Wx!e1d<d=ƒD]Z2d>e0e2<qJWd?efd@„ƒYZ3dAefdB„ƒYZ4dCefdD„ƒYZ5dEefdF„ƒYZ6dGefdH„ƒYZ7dIS(Jsk EFI Platform Initialization Firmware Volume parser. Author: Alexandre Boeglin Creation date: 08 jul 2007 iÿÿÿÿ(tParser( tFieldSettUInt8tUInt16tUInt24tUInt32tUInt64tEnumtCStringtStringt PaddingBytestRawBytest NullBytes(t LITTLE_ENDIAN(t paddingSizet humanFilesize(tGUIDiiiiiiiiiiiiis*Encapsulation section where other sectionss are compresseds have format defined by a GUIDsPE32+ Executable imagesPosition-Independent CodesTerse Executable imagesDXE Dependency ExpressionsVersion, Text and Numerics User-Friendly name of the driversDOS-style 16-bit EXEsPI Firmware Volume imagesRaw data with GUID in header tos define formatsRaw datasPEI Dependency Expressioniiiiiii i iðs Binary datasSectioned datas&Platform core code used during the SECs phasesPEI FoundationsDXE FoundationsPEI module (PEIM)s DXE driversCombined PEIM/DXE drivert ApplicationsFirmware volume imagesPad File For FFSiÀiàsOEM FilesDebug/Test Fileiñis"Firmware File System Specific FiletBlockMapcBs eZdZd„Zd„ZRS(iccs t|dƒVt|dƒVdS(Nt num_blockstlen(R(tself((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyt createFieldsUscCs"d|dit|diƒfS(Ns%d blocks of %sRR(tvalueR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pytcreateDescriptionYsi@(t__name__t __module__t static_sizeRR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyRSs t FileSectioncBs7eZhdd6dd6Zd„Zd„Zd„ZRS(sNot CompressedisStandard CompressionicOs‰ti|||Ž|did|_|di}|ttfjo>|ii|i|idƒdjo|id|_q…ndS(Ntsizeittypeiti( Rt__init__Rt_sizetEFI_SECTION_DXE_DEPEXtEFI_SECTION_PEI_DEPEXtstreamt readBytestabsolute_address(Rtargstkwt section_type((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR ds ccsÿt|dƒVtt|dƒtƒV|di}|tjo,t|dƒVtt|dƒ|iƒVn³|tjot |dƒVn”|t jo.t |dƒVt |dƒVt |dƒVnY|t jot |d d d ƒVn4|tjo&t |d ƒVt |d d d ƒVn|i|id}|djodS|tjoe|di}|djo'xD|ipt|d|ƒVqmWqûxg|ipt|dƒVq”WnG|tjot|dƒVn(t|d|ti|didƒƒVdS(NRRt uncomp_lent comp_typet sub_type_guidtsection_definition_guidt data_offsett attributest file_nametcharsets UTF-16-LEt build_numbertversioniiitcompressed_contents section[]tfirmware_volumetcontentsUnknown Section Type(RRRtEFI_SECTION_TYPERtEFI_SECTION_COMPRESSIONRtCOMPRESSION_TYPEt!EFI_SECTION_FREEFORM_SUBTYPE_GUIDRtEFI_SECTION_GUID_DEFINEDRtEFI_SECTION_USER_INTERFACERtEFI_SECTION_VERSIONRt current_sizeteofR Rt!EFI_SECTION_FIRMWARE_VOLUME_IMAGEtFirmwareVolumetget(RR)t content_sizetcompression_type((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyRpsD              cCsti|didƒS(NRsUnknown Section Type(R7RBR(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR™s(RRR9R RR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR^s   )tFilecBs#eZd„Zd„Zd„ZRS(cOs+ti|||Ž|did|_dS(NRi(RR RR!(RR'R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR Ÿsccs�t|dƒVt|dƒVtt|dƒtƒVt|dƒVt|dƒVt|dƒVx|ipt|dƒVq`WdS(Ntnametintegrity_checkRR/Rtstates section[](RRRRtEFI_FV_FILETYPERR?R(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR£s cCs.d|di|dit|idƒƒfS(Ns%s: %s containing %d section(s)RFRtsection(RtdisplayRtarray(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR°s  (RRR RR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyREžs  RAcBs#eZd„Zd„Zd„ZRS(cOs9ti|||Ž|ip|did|_ndS(Nt volume_leni(RR R!R(RR'R(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR ¸s ccs8t|ddƒVt|dƒVt|dƒVt|ddƒVt|dƒVt|dƒVt|d ƒVt|d ƒVt|d ƒVt|d ƒVxMtoEt|d ƒ}|V|di djo|di djoPq•q•WxO|i pDt |i ddƒ}|ot |d|ƒVnt|dƒVqåWdS(Nt zero_vectoritfs_guidRMt signatureiR/t header_lentchecksumtext_header_offsettreservedtrevisions block_map[]RiRis padding[]sfile[](R RRR RRRtTrueRRR?RR>R RE(Rtbmtpadding((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR½s,(  cCsdt|idƒƒS(Ns%Firmware Volume containing %d file(s)tfile(RRL(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyR×s(RRR RR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyRA·s  tPIFVFilecBsceZeZdZhdd6dd6dd6dd 6d ed ffd 6dd6Zd„Zd„ZRS(t_FVHtpifvtidtprogramtcategorytbinttfile_exti@itmin_sizet {16}.{24}%sit magic_regexs+EFI Platform Initialization Firmware Volumet descriptioncCsI|iid dƒ|ijodS|iiddƒd jodStS( Ni(iisInvalid magic numberiiRsInvalid zero vectori@t(R$R%tMAGICRV(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pytvalidateçs ccs$x|ipt|dƒVqWdS(Nsfirmware_volume[](R?RA(R((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyRîs (sbinRai(RRR tendianRht PARSER_TAGSRiR(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyRZÛs  N(8t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R thachoir_core.endianR thachoir_core.toolsRRthachoir_parser.common.win32RR8R;tEFI_SECTION_PE32tEFI_SECTION_PICtEFI_SECTION_TER"R=R<tEFI_SECTION_COMPATIBILITY16R@R:tEFI_SECTION_RAWR#R7tEFI_FV_FILETYPE_RAWtEFI_FV_FILETYPE_FREEFORMtEFI_FV_FILETYPE_SECURITY_COREtEFI_FV_FILETYPE_PEI_COREtEFI_FV_FILETYPE_DXE_COREtEFI_FV_FILETYPE_PEIMtEFI_FV_FILETYPE_DRIVERt$EFI_FV_FILETYPE_COMBINED_PEIM_DRIVERtEFI_FV_FILETYPE_APPLICATIONt%EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGEtEFI_FV_FILETYPE_FFS_PADRItxrangetxRRRERARZ(((sB/pentest/enumeration/google/metagoofil/hachoir_parser/misc/pifv.pyt<module>s’R   @$
9,831
Python
.py
39
251.051282
953
0.478248
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,688
msoffice_summary.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/msoffice_summary.pyc
—Ú Œ »Mc @sKdZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZlZlZlZlZlZlZlZlZddklZlZlZddkl Z ddk!l"Z"l#Z#ddk$l%Z%l&Z&ddk'l(Z(l)Z)d Z*d Z+hd d 6d d 6dd6Z,dd)dÑÉYZ-defdÑÉYZ.defdÑÉYZ/defdÑÉYZ0defdÑÉYZ1de1fe1i2d<defdÑÉYZ3defdÑÉYZ4d d*d!ÑÉYZ5d"e5eefd#ÑÉYZ6d$e5efd%ÑÉYZ7d&efd'ÑÉYZ8d(S(+sç Microsoft Document summaries structures. Documents --------- - Apache POI (HPSF Internals): http://poi.apache.org/hpsf/internals.html iˇˇˇˇ(t HachoirParser(tFieldSett ParserErrortRootSeekableFieldSettSeekableFieldSettBittBitstNullBitstUInt8tUInt16tUInt32tTimestampWin64tTimedeltaWin64tEnumtBytestRawBytest NullBytestStringtInt8tInt16tInt32tFloat32tFloat64tPascalString32(t textHandlert hexadecimaltfilesizeHandler(t createDict(t LITTLE_ENDIANt BIG_ENDIAN(tGUIDtPascalStringWin32(t BmpHeadertparseImageDataidisWindows 16-bitit MacintoshsWindows 32-bititOSConfigcBseZdÑZRS(cCs3|od|_d|_nd|_d|_dS(NtMacRomans UTF-16-BEs UTF-16-LE(tcharsettutf16tNone(tselft big_endian((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyt__init__!s    (t__name__t __module__R*(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR# st PropertyIndexcBsÄeZdZhdd6dd6dd6dd6Zhdd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36ZeieÉhd4d 6d5d 6d6d 6d7d6d8d6d9d6d:d6d;d6d<d6d=d6d>d6d?d6d@d!6dAd#6dBd%6dCd'6dDd)6dEd+6ZeieÉdFÑZdGÑZRS(Hit DictionaryitCodePagetLOCALE_SYSTEM_DEFAULTltCASE_SENSITIVEltCategoryitPresentationFormatitNumBytesitNumLinesit NumParagraphsit NumSlidesitNumNotesitNumHiddenSlidesi t NumMMClipsi tScalei t HeadingPairsi t DocumentPartsi tManageritCompanyit LinksDirtyit DocSumInfo_17it DocSumInfo_18it DocSumInfo_19it DocSumInfo_20it DocSumInfo_21it DocSumInfo_22it DocSumInfo_23itTitletSubjecttAuthortKeywordstCommentstTemplatet LastSavedBytRevisionNumbertTotalEditingTimet LastPrintedt CreateTimet LastSavedTimetNumPagestNumWordst NumCharacterst ThumbnailtAppNametSecurityccsV|diidÉo |i}n |i}tt|dÉ|ÉVt|dÉVdS(Ns../..t doc_summarytidtoffset(tnamet startswithtDOCUMENT_PROPERTYtCOMPONENT_PROPERTYR R (R(tenum((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyt createFieldses   cCsd|diS(Ns Property: %sR[(tdisplay(R(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pytcreateDescriptionms( R+R,t TAG_CODEPAGEtCOMMON_PROPERTYR_tupdateR`RbRd(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR-+sh      tBoolcBseZdÑZRS(cCsti|É}|djS(Niˇˇˇˇ(Rt createValue(R(tvalue((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRiqs(R+R,Ri(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRhpsRWcBsåeZdZdZhdd6dd6dd6dd6d d 6d d 6d d6dd6ZdZhdd 6dd 6dd6dd6ZdÑZdÑZRS(sl Thumbnail. Documents: - See Jakarta POI http://jakarta.apache.org/poi/hpsf/thumbnails.html http://www.penguin-soft.com/penguin/developer/poi/ org/apache/poi/hpsf/Thumbnail.html#CF_BITMAP - How To Extract Thumbnail Images http://sparks.discreet.com/knowledgebase/public/ solutions/ExtractThumbnailImg.htm iˇˇˇˇsWindows clipboardsMacintosh clipboardi˛ˇˇˇs$GUID that contains format identifieri˝ˇˇˇsNo dataitBitmapisWindows metafile formatisDevice Independent Bitmap (DIB)isEnhanced Windows metafileisBitmap Obsolete (old BMP)sWindows metafile format (WMF)sDevice Independent Bitmap (BMP)sEnhanced Windows metafile (EMF)cGs(ti||å|did|_dS(Ntsizei(RR*Rjt_size(R(targs((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR*ïsccsÌtt|dÉÉVtt|dÉ|iÉV|di|ijottt|dÉ|iÉV|di|ijo?t |dÉV|i |i d}t |d||dÉVdSn|i |i d}|ot |d|ÉVndS(NRltformatt dib_formatt bmp_headeritpixelstdata(RR R Rt FORMAT_NAMERjtFORMAT_CLIPBOARDt DIB_FORMATtDIB_BMPR Rlt current_sizeR!R(R(Rl((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRbôs ( R+R,t__doc__RuRtRwRvR*Rb(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRWus&    tPropertyContentcBsÅeZdZh)dTd6dUd6defd6defd6d efd 6d efd 6dVd6dWd6dXd6dYd6dZd6defd6d[d6d\d6d]d6d^d 6d_d"6d`d$6dad&6dbd(6dcd*6ddd,6ded.6dfd06dgd26dhd46did66djd86dkd:6d;e fd6d<e fd=6d>e fd?6dldA6dmdC6dndE6dodG6dpdI6dqdK6dLe fdM6drdO6dsdQ6Z e e dÉZdRÑZRS(titEMPTYitNULLiR iR iRiRitCYitDATEitBSTRitDISPATCHi tERRORi tBOOLi tVARIANTi tUNKNOWNi tDECIMALitI1itUI1itUI2itUI4itI8itUI8itINTitUINTitVOIDitHRESULTitPTRit SAFEARRAYitCARRAYit USERDEFINEDitLPSTRtLPWSTRitFILETIMEi@tBLOBiAtSTREAMiBtSTORAGEiCtSTREAMED_OBJECTiDt STORED_OBJECTiEt BLOB_OBJECTiFt THUMBNAILiGtCLSIDiHtVectoric#s¬àiià_to@ttàddÉàiÉVtàdÉVtàddÉVnttàddÉàiÉVàdi}h}yàài |d}|t jo;ài}|ài jo|i |d<q |i |d<n,|tjoàidjo t}q nWntj o d}nX|ptd àdiÉÇnàdioAtàd ÉVxStàd iÉD]}|àd |çVq|Wn$|àd |çVáfd Üà_dS(Nttypei t is_vectortpaddingi iR%RPs)OLE2: Unable to parse property of type %stcountsitem[]Rjcs àdiS(Rj(Rj((R((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyt<lambda>ˆsii(tparenttosconfigtTrueR Rt TYPE_NAMERRRjt TYPE_INFORt TYPE_LPSTRR%R&R t descriptionR t LookupErrorR'RRcR txrangeRi(R(ttagtkwthandlerR¶tindex((R(sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRb÷s<     N(R{N(sNULLN(R}N(R~N(RN(RÄN(RÅN(RÉN(sUNKNOWNN(RÖN(RÜN(RáN(RàN(RâN(RäN(RãN(sINTN(RçN(RéN(RèN(RêN(RëN(RíN(RìN(RóN(RòN(RôN(RöN(RõN(RúN(RûN(sVectorN(R+R,R™R'R R RRRhRR RWR©RR®Rb(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRzßsZ          RÉi tSummarySectioncBs5eZhdd6dd6dd6ZdÑZdÑZRS(s WINDOWS-1252i‰s WINDOWS-1253iÂsUTF-8iÈ˝cGs(ti||å|did|_dS(NRli(RR*RjRm(R(Rn((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR*sccs,|ii|_t|dÉVt|dÉVx)t|diÉD]}t|dÉVq?WxŒt|diÉD]π}|d|}|i|diÉt|d|diÉ}|V|ii oe|diti joN|di}||i jo|i i |É|i_ q$|i d |ÉqkqkWdS( NRltproperty_countsproperty_index[]sproperty_index[%u]R\s property[]R[RjsUnknown codepage: %r(R•R¶R R≠RjR-tseekByteRzRcR%RetCODEPAGE_CHARSETtgettwarning(R(R±tfindextfieldtcodepage((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRbs$ (R+R,RµR*Rb(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR≤˘s   t SummaryIndexcBseZdZdÑZRS(iiccs#t|ddÉVt|dÉVdS(NR]iR\(RR (R(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRbsi†(R+R,t static_sizeRb(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRªst BaseSummarycBs eZeZdÑZdÑZRS(cCsn|didjo t|_n.|didjo t|_n tdÉÇt|ditjÉ|_dS(Ntendiansˇ˛s˛ˇsOLE2: Invalid endian valuetos_type(RjRRæRRR#tOS_MACR¶(R(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR* s    ccsUt|dddÉVt|ddÉVt|dÉVt|dÉVtt|dÉtÉVt|d ÉVt|d ÉVt|d ijot d |d iÉÇng}x<t |d iÉD]'}t |d É}|V|i |ÉqΩWx0|D](}|i |d iÉt|dÉVqÔW|i|id}d|jot|d|ÉVndS(NRæisEndian (0xFF 0xFE for Intel)Ros Format (0)t os_versiont os_revisionRøt format_idt section_countsOLE2: Too much sections (%s)ssection_index[]R\s section[]iit end_padding(RR RR tOS_NAMERR tMAX_SECTION_COUNTRjRR≠RªtappendR¥R≤RlRxR(R(tsection_indexesR±t section_indexRl((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRb)s, (R+R,RRæR*Rb(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRΩs t SummaryParsercBs'eZhdd6ZdÑZdÑZRS(sMicrosoft Office summaryR´cKsIti|dd|d|i|ÉÉti|||çti|ÉdS(Ntroot(RR*R'taskSizeRRΩ(R(tstreamRØ((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR*Gs%cCstS(N(Rß(R(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pytvalidateLs(R+R,t PARSER_TAGSR*Rœ(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRÀBs  tSummaryFieldSetcBseZdddÑZRS(cCs0ti|||d|d|Éti|ÉdS(NR´Rl(RR*RΩ(R(R•R]R´Rl((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR*PsN(R+R,R'R*(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR—OstCompObjcBseZhdd6ZdÑZRS(s Windows 3.1i ccs≠t|ddÉVtt|ddÉtÉVt|dÉVt|dÉVtt|dÉtÉVt|dd ÉVt|d ÉVt|d d d ÉV|di t jo&t|ddÉVt |ddÉVnt|dd d ÉV|i |i jodSt|dd d ÉV|di t joZtt|ddÉtÉVt|dd d ÉVt|dd d ÉVt|dd d ÉVn|i |i d}|ot|d|ÉVndS(Ntversions Version (=1)RæsEndian (0xFF 0xFE for Intel)R¡R¬Røtunuseds(=-1)tclsidt user_typetstriptsunused[]s(=-2)tclipboard_formatitprog_idtmagicsMagic number (0x71B239F4)tuser_type_unicodetclipboard_format_unicodetprog_id_unicodeiR≈(R RRRR R∆RRRRjR¿RRxRlR RR(R(Rl((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyRbXs.(R+R,t OS_VERSIONRb(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyR“Ts N(((9Rythachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R RRRRRRRRRRthachoir_core.text_handlerRRRthachoir_core.toolsRthachoir_core.endianRRthachoir_parser.common.win32RRthachoir_parser.image.bmpR R!R«R¿R∆R#R-RhRWRzR©R≤RªRΩRÀR—R“(((sN/pentest/enumeration/google/metagoofil/hachoir_parser/misc/msoffice_summary.pyt<module> s2î  E2P% 
15,763
Python
.py
87
179.436782
1,178
0.469248
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,689
file_3do.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/file_3do.py
# -*- coding: utf-8 -*- """ 3do model parser. Author: Cyril Zorin Creation date: 28 september 2006 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, UInt32, Int32, String, Float32, RawBytes, PaddingBytes) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_parser.misc.common import Vertex, MapUV class Vector(FieldSet): def __init__(self, parent, name, count, type, ename, edesc=None, description=None): FieldSet.__init__(self, parent, name, description) self.count = count self.type = type self.ename = ename+"[]" self.edesc = edesc try: item_size = self.type.static_size(self.ename, self.edesc) except TypeError: item_size = self.type.static_size if item_size: self._size = item_size * self.count def createFields(self): for index in xrange(self.count): yield self.type(self, self.ename, self.edesc) class Face(FieldSet): def createFields(self): yield UInt32(self, "id") yield UInt32(self, "type") yield UInt32(self, "geometry_mode") yield UInt32(self, "lighting_mode") yield UInt32(self, "texture_mode") yield UInt32(self, "nvertices") yield Float32(self, "unknown[]", "unknown") yield UInt32(self, "has_texture", "Has texture?") yield UInt32(self, "has_material", "Has material?") yield Vertex(self, "unknown[]") yield Float32(self, "extra_light") yield Vertex(self, "unknown[]") yield Vertex(self, "normal") if self["nvertices"].value: yield Vector(self, "vertex_indices", self["nvertices"].value, UInt32, "vertex") if self["has_texture"].value: yield Vector(self, "texture_vertex_indices", self["nvertices"].value, UInt32, "texture_vertex") if self["has_material"].value: yield UInt32(self, "material_index", "material index") def createDescription(self): return "Face: id=%s" % self["id"].value class Mesh(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) def createFields(self): yield String(self, "name", 32, strip="\0") yield UInt32(self, "id") yield UInt32(self, "geometry_mode") yield UInt32(self, "lighting_mode") yield UInt32(self, "texture_mode") yield UInt32(self, "nmesh_vertices") yield UInt32(self, "ntexture_vertices") yield UInt32(self, "nfaces") nb_vert = self["nmesh_vertices"].value if nb_vert: yield Vector(self, "vertices", nb_vert, Vertex, "vertex") if self["ntexture_vertices"].value: yield Vector(self, "texture vertices", self["ntexture_vertices"].value, MapUV, "texture_vertex") if nb_vert: yield Vector(self, "light vertices", nb_vert, Float32, "extra_light") yield Vector(self, "unknown[]", nb_vert, Float32, "unknown") if self["nfaces"].value: yield Vector(self, "faces", self["nfaces"].value, Face, "face") if nb_vert: yield Vector(self, "vertex normals", nb_vert, Vertex, "normal") yield UInt32(self, "has_shadow") yield Float32(self, "unknown[]") yield Float32(self, "radius") yield Vertex(self, "unknown[]") yield Vertex(self, "unknown[]") def createDescription(self): return 'Mesh "%s" (id %s)' % (self["name"].value, self["id"].value) class Geoset(FieldSet): def createFields(self): yield UInt32(self, "count") for index in xrange(self["count"].value): yield Mesh(self, "mesh[]") def createDescription(self): return "Set of %s meshes" % self["count"].value class Node(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) size = (188-4)*8 if self["parent_offset"].value != 0: size += 32 if self["first_child_offset"].value != 0: size += 32 if self["next_sibling_offset"].value != 0: size += 32 self._size = size def createFields(self): yield String(self, "name", 32, strip="\0") yield PaddingBytes(self, "unknown[]", 32, pattern="\xCC") yield UInt32(self, "flags") yield UInt32(self, "id") yield UInt32(self, "type") yield Int32(self, "mesh_id") yield UInt32(self, "depth") yield Int32(self, "parent_offset") yield UInt32(self, "nchildren") yield UInt32(self, "first_child_offset") yield UInt32(self, "next_sibling_offset") yield Vertex(self, "pivot") yield Vertex(self, "position") yield Float32(self, "pitch") yield Float32(self, "yaw") yield Float32(self, "roll") for index in xrange(4): yield Vertex(self, "unknown_vertex[]") if self["parent_offset"].value != 0: yield UInt32(self, "parent_id") if self["first_child_offset"].value != 0: yield UInt32(self, "first_child_id") if self["next_sibling_offset"].value != 0: yield UInt32(self, "next_sibling_id") def createDescription(self): return 'Node "%s"' % self["name"].value class Nodes(FieldSet): def createFields(self): yield UInt32(self, "count") for index in xrange(self["count"].value): yield Node(self, "node[]") def createDescription(self): return 'Nodes (%s)' % self["count"].value class Materials(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) count = self["count"] self._size = count.size + count.value * (32*8) def createFields(self): yield UInt32(self, "count") for index in xrange(self["count"].value): yield String(self, "filename[]", 32, "Material file name", strip="\0") def createDescription(self): return 'Material file names (%s)' % self["count"].value class File3do(Parser): PARSER_TAGS = { "id": "3do", "category": "misc", "file_ext": ("3do",), "mime": (u"image/x-3do",), "min_size": 8*4, "description": "renderdroid 3d model." } endian = LITTLE_ENDIAN def validate(self): signature = self.stream.readBytes(0, 4) return signature in ('LDOM', 'MODL') # lazy endian-safe hack =D def createFields(self): # Read file signature, and fix endian if needed yield String(self, "file_sig", 4, "File signature", charset="ASCII") if self["file_sig"].value == "MODL": self.endian = BIG_ENDIAN # Read file content yield Materials(self, "materials") yield String(self, "model_name", 32, "model file name", strip="\0") yield RawBytes(self, "unknown[]", 4) yield UInt32(self, "ngeosets") for index in xrange(self["ngeosets"].value): yield Geoset(self, "geoset[]") yield RawBytes(self, "unknown[]", 4) yield Nodes(self, "nodes") yield Float32(self, "model_radius") yield Vertex(self, "insertion_offset") # Read the end of the file if self.current_size < self._size: yield self.seekBit(self._size, "end")
7,431
Python
.py
185
31.464865
82
0.591104
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,690
ole2.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/ole2.py
""" Microsoft Office documents parser. Informations: * wordole.c of AntiWord program (v0.35) Copyright (C) 1998-2003 A.J. van Os Released under GNU GPL http://www.winfield.demon.nl/ * File gsf-infile-msole.c of libgsf library (v1.14.0) Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) Released under GNU LGPL 2.1 http://freshmeat.net/projects/libgsf/ * PDF from AAF Association Copyright (C) 2004 AAF Association Copyright (C) 1991-2003 Microsoft Corporation http://www.aafassociation.org/html/specs/aafcontainerspec-v1.0.1.pdf Author: Victor Stinner Creation: 2006-04-23 """ from hachoir_parser import HachoirParser from hachoir_core.field import ( FieldSet, ParserError, SeekableFieldSet, RootSeekableFieldSet, UInt8, UInt16, Int32, UInt32, UInt64, TimestampWin64, Enum, Bytes, RawBytes, NullBytes, String) from hachoir_core.text_handler import textHandler, hexadecimal, filesizeHandler from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_parser.common.win32 import GUID from hachoir_parser.misc.msoffice import CustomFragment, OfficeRootEntry, PROPERTY_NAME from hachoir_parser.misc.word_doc import WordDocumentParser from hachoir_parser.misc.msoffice_summary import SummaryParser MIN_BIG_BLOCK_LOG2 = 6 # 512 bytes MAX_BIG_BLOCK_LOG2 = 14 # 64 kB # Number of items in DIFAT NB_DIFAT = 109 class SECT(UInt32): UNUSED = 0xFFFFFFFF # -1 END_OF_CHAIN = 0xFFFFFFFE # -2 BFAT_SECTOR = 0xFFFFFFFD # -3 DIFAT_SECTOR = 0xFFFFFFFC # -4 SPECIALS = set((END_OF_CHAIN, UNUSED, BFAT_SECTOR, DIFAT_SECTOR)) special_value_name = { UNUSED: "unused", END_OF_CHAIN: "end of a chain", BFAT_SECTOR: "BFAT sector (in a FAT)", DIFAT_SECTOR: "DIFAT sector (in a FAT)", } def __init__(self, parent, name, description=None): UInt32.__init__(self, parent, name, description) def createDisplay(self): val = self.value return SECT.special_value_name.get(val, str(val)) class Property(FieldSet): TYPE_ROOT = 5 TYPE_NAME = { 1: "storage", 2: "stream", 3: "ILockBytes", 4: "IPropertyStorage", 5: "root" } DECORATOR_NAME = { 0: "red", 1: "black", } static_size = 128 * 8 def createFields(self): bytes = self.stream.readBytes(self.absolute_address, 4) if bytes == "\0R\0\0": charset = "UTF-16-BE" else: charset = "UTF-16-LE" yield String(self, "name", 64, charset=charset, truncate="\0") yield UInt16(self, "namelen", "Length of the name") yield Enum(UInt8(self, "type", "Property type"), self.TYPE_NAME) yield Enum(UInt8(self, "decorator", "Decorator"), self.DECORATOR_NAME) yield SECT(self, "left") yield SECT(self, "right") yield SECT(self, "child", "Child node (valid for storage and root types)") yield GUID(self, "clsid", "CLSID of this storage (valid for storage and root types)") yield NullBytes(self, "flags", 4, "User flags") yield TimestampWin64(self, "creation", "Creation timestamp(valid for storage and root types)") yield TimestampWin64(self, "lastmod", "Modify timestamp (valid for storage and root types)") yield SECT(self, "start", "Starting SECT of the stream (valid for stream and root types)") if self["/header/bb_shift"].value == 9: yield filesizeHandler(UInt32(self, "size", "Size in bytes (valid for stream and root types)")) yield NullBytes(self, "padding", 4) else: yield filesizeHandler(UInt64(self, "size", "Size in bytes (valid for stream and root types)")) def createDescription(self): name = self["name"].display size = self["size"].display return "Property: %s (%s)" % (name, size) class DIFat(SeekableFieldSet): def __init__(self, parent, name, db_start, db_count, description=None): SeekableFieldSet.__init__(self, parent, name, description) self.start=db_start self.count=db_count def createFields(self): for index in xrange(NB_DIFAT): yield SECT(self, "index[%u]" % index) for index in xrange(self.count): # this is relative to real DIFAT start self.seekBit(NB_DIFAT * SECT.static_size+self.parent.sector_size*(self.start+index)) for sect_index in xrange(NB_DIFAT*(index+1),NB_DIFAT*(index+2)): yield SECT(self, "index[%u]" % sect_index) class Header(FieldSet): static_size = 68 * 8 def createFields(self): yield GUID(self, "clsid", "16 bytes GUID used by some apps") yield UInt16(self, "ver_min", "Minor version") yield UInt16(self, "ver_maj", "Minor version") yield Bytes(self, "endian", 2, "Endian (0xFFFE for Intel)") yield UInt16(self, "bb_shift", "Log, base 2, of the big block size") yield UInt16(self, "sb_shift", "Log, base 2, of the small block size") yield NullBytes(self, "reserved[]", 6, "(reserved)") yield UInt32(self, "csectdir", "Number of SECTs in directory chain for 4 KB sectors (version 4)") yield UInt32(self, "bb_count", "Number of Big Block Depot blocks") yield SECT(self, "bb_start", "Root start block") yield NullBytes(self, "transaction", 4, "Signature used for transactions (must be zero)") yield UInt32(self, "threshold", "Maximum size for a mini stream (typically 4096 bytes)") yield SECT(self, "sb_start", "Small Block Depot start block") yield UInt32(self, "sb_count") yield SECT(self, "db_start", "First block of DIFAT") yield UInt32(self, "db_count", "Number of SECTs in DIFAT") # Header (ole_id, header, difat) size in bytes HEADER_SIZE = 64 + Header.static_size + NB_DIFAT * SECT.static_size class SectFat(FieldSet): def __init__(self, parent, name, start, count, description=None): FieldSet.__init__(self, parent, name, description, size=count*32) self.count = count self.start = start def createFields(self): for i in xrange(self.start, self.start + self.count): yield SECT(self, "index[%u]" % i) class OLE2_File(HachoirParser, RootSeekableFieldSet): PARSER_TAGS = { "id": "ole2", "category": "misc", "file_ext": ( "doc", "dot", # Microsoft Word "ppt", "ppz", "pps", "pot", # Microsoft Powerpoint "xls", "xla", # Microsoft Excel "msi", # Windows installer ), "mime": ( u"application/msword", u"application/msexcel", u"application/mspowerpoint", ), "min_size": 512*8, "description": "Microsoft Office document", "magic": (("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1", 0),), } endian = LITTLE_ENDIAN def __init__(self, stream, **args): RootSeekableFieldSet.__init__(self, None, "root", stream, None, stream.askSize(self)) HachoirParser.__init__(self, stream, **args) def validate(self): if self["ole_id"].value != "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1": return "Invalid magic" if self["header/ver_maj"].value not in (3, 4): return "Unknown major version (%s)" % self["header/ver_maj"].value if self["header/endian"].value not in ("\xFF\xFE", "\xFE\xFF"): return "Unknown endian (%s)" % self["header/endian"].raw_display if not(MIN_BIG_BLOCK_LOG2 <= self["header/bb_shift"].value <= MAX_BIG_BLOCK_LOG2): return "Invalid (log 2 of) big block size (%s)" % self["header/bb_shift"].value if self["header/bb_shift"].value < self["header/sb_shift"].value: return "Small block size (log2=%s) is bigger than big block size (log2=%s)!" \ % (self["header/sb_shift"].value, self["header/bb_shift"].value) return True def createFields(self): # Signature yield Bytes(self, "ole_id", 8, "OLE object signature") header = Header(self, "header") yield header # Configure values self.sector_size = (8 << header["bb_shift"].value) self.fat_count = header["bb_count"].value self.items_per_bbfat = self.sector_size / SECT.static_size self.ss_size = (8 << header["sb_shift"].value) self.items_per_ssfat = self.items_per_bbfat # Read DIFAT (one level of indirection) yield DIFat(self, "difat", header["db_start"].value, header["db_count"].value, "Double Indirection FAT") # Read FAT (one level of indirection) for field in self.readBFAT(): yield field # Read SFAT for field in self.readSFAT(): yield field # Read properties chain = self.getChain(self["header/bb_start"].value) prop_per_sector = self.sector_size // Property.static_size self.properties = [] for block in chain: self.seekBlock(block) for index in xrange(prop_per_sector): property = Property(self, "property[]") yield property self.properties.append(property) # Parse first property for index, property in enumerate(self.properties): if index == 0: name = "root" else: try: name = PROPERTY_NAME[property["name"].value] except LookupError: name = property.name+"content" for field in self.parseProperty(property, name): yield field def parseProperty(self, property, name_prefix): if not property["size"].value: return if property.name != "property[0]" \ and (property["size"].value < self["header/threshold"].value): # Field is stored in the ministream, skip it return name = "%s[]" % name_prefix first = None previous = None size = 0 fragment_group = None chain = self.getChain(property["start"].value) while True: try: block = chain.next() contiguous = False if not first: first = block contiguous = True if previous and block == (previous+1): contiguous = True if contiguous: previous = block size += self.sector_size continue except StopIteration: block = None if first is None: break self.seekBlock(first) desc = "Big blocks %s..%s (%s)" % (first, previous, previous-first+1) desc += " of %s bytes" % (self.sector_size // 8) if name_prefix in set(("root", "summary", "doc_summary", "word_doc")): if name_prefix == "root": parser = OfficeRootEntry elif name_prefix == "word_doc": parser = WordDocumentParser else: parser = SummaryParser field = CustomFragment(self, name, size, parser, desc, fragment_group) yield field if not fragment_group: fragment_group = field.group else: yield RawBytes(self, name, size//8, desc) if block is None: break first = block previous = block size = self.sector_size def getChain(self, start, use_sfat=False): if use_sfat: fat = self.ss_fat items_per_fat = self.items_per_ssfat err_prefix = "SFAT chain" else: fat = self.bb_fat items_per_fat = self.items_per_bbfat err_prefix = "BFAT chain" block = start block_set = set() previous = block while block != SECT.END_OF_CHAIN: if block in SECT.SPECIALS: raise ParserError("%s: Invalid block index (0x%08x), previous=%s" % (err_prefix, block, previous)) if block in block_set: raise ParserError("%s: Found a loop (%s=>%s)" % (err_prefix, previous, block)) block_set.add(block) yield block previous = block index = block // items_per_fat try: block = fat[index]["index[%u]" % block].value except LookupError, err: break def readBFAT(self): self.bb_fat = [] start = 0 count = self.items_per_bbfat for index, block in enumerate(self.array("difat/index")): block = block.value if block == SECT.UNUSED: break desc = "FAT %u/%u at block %u" % \ (1+index, self["header/bb_count"].value, block) self.seekBlock(block) field = SectFat(self, "bbfat[]", start, count, desc) yield field self.bb_fat.append(field) start += count def readSFAT(self): chain = self.getChain(self["header/sb_start"].value) start = 0 self.ss_fat = [] count = self.items_per_ssfat for index, block in enumerate(chain): self.seekBlock(block) field = SectFat(self, "sfat[]", \ start, count, \ "SFAT %u/%u at block %u" % \ (1+index, self["header/sb_count"].value, block)) yield field self.ss_fat.append(field) start += count def createContentSize(self): max_block = 0 for fat in self.array("bbfat"): for entry in fat: block = entry.value if block not in SECT.SPECIALS: max_block = max(block, max_block) if max_block in SECT.SPECIALS: return None else: return HEADER_SIZE + (max_block+1) * self.sector_size def seekBlock(self, block): self.seekBit(HEADER_SIZE + block * self.sector_size)
14,245
Python
.py
327
33.541284
114
0.58409
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,691
__init__.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/__init__.pyc
Ñò Î ÈMc@sÔddklZddklZddklZddklZddkl Z ddk l Z ddk l Z ddklZdd klZdd klZdd klZdd klZdd klZdS(iÿÿÿÿ(tFile3do(tFile3ds(t TorrentFile(tTrueTypeFontFile(tChmFile(tLnkFile(tPcfFile(t OLE2_File(t PDFDocument(tPIFVFile(tHlpFile(t GnomeKeyring(tBPListN(thachoir_parser.misc.file_3doRthachoir_parser.misc.file_3dsRthachoir_parser.misc.torrentRthachoir_parser.misc.ttfRthachoir_parser.misc.chmRthachoir_parser.misc.lnkRthachoir_parser.misc.pcfRthachoir_parser.misc.ole2Rthachoir_parser.misc.pdfRthachoir_parser.misc.pifvR thachoir_parser.misc.hlpR t!hachoir_parser.misc.gnome_keyringR thachoir_parser.misc.bplistR (((sF/pentest/enumeration/google/metagoofil/hachoir_parser/misc/__init__.pyt<module>s
1,097
Python
.py
5
218.4
699
0.537054
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,692
gnome_keyring.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/gnome_keyring.pyc
—Ú Œ »Mc@s‚dZddklZddklZddklZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZddklZddklZyddkZdÑZWnej od ÑZnXy0dd klZd d d ÑÉYZd ÑZWnej odÑZnXdefdÑÉYZdefdÑÉYZdefdÑÉYZ defdÑÉYZ!defdÑÉYZ"defdÑÉYZ#defdÑÉYZ$defdÑÉYZ%dÑZ&dS(!s® Gnome keyring parser. Sources: - Gnome Keyring source code, function generate_file() in keyrings/gkr-keyring.c, Author: Victor Stinner Creation date: 2008-04-09 iˇˇˇˇ(t paddingSize(tParser( tFieldSettBittNullBitst NullBytestUInt8tUInt32tStringtRawBytestEnumtPascalString32tTimestampUnix64tCompressedFieldtSubFile(t BIG_ENDIAN(t hexversionNcCs&tidÉ}|i|É|iÉS(Ntsha256(thashlibtnewtupdatetdigest(tdatathash((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRs cCstdÉÇdS(Nshashlib module is missing(t ImportError(R((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRs(tAESt DeflateStreamcBseZdÑZddÑZRS(cCsId}d}d}t|||É\}}ti|ti|É|_dS(Ni“txittxxxxxxxxt(t generate_keyRRtMODE_CBCtcipher(tselftstreamthash_iterationstpasswordtsalttkeytiv((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyt__init__#s cCs"|djodS|ii|ÉS(Nt(tNoneR!tdecrypt(R"tsizeR((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyt__call__*s N(t__name__t __module__R)R+R.(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR"s cCst|tÉ|S(N(R R(tfield((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pytDeflate/s cCs|S(N((R1((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR23st KeyringStringcBs#eZdÑZdÑZdÑZRS(ccsHt|dÉV|di}|djodSt|d|ddÉVdS(NtlengthlˇˇttexttcharsetsUTF-8(RtvalueR(R"R4((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyt createFields7s   cCs!d|jo |diSdSdS(NR5u(R7(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyt createValue>s  cCs!d|jo |diSdSdS(NR5u(empty string)(R7(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pytcreateDescriptionDs  (R/R0R8R9R:(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR36s  t AttributecBseZdÑZdÑZRS(ccs{t|dÉVt|dÉV|di}|djot|dÉVn0|djot|dÉVntd|ÉÇdS(NtnamettypeiR7isUnknown attribute type (%s)(R3RR7t TypeError(R"R=((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8Ks   cCsd|diS(NsAttribute "%s"R<(R7(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR:Vs(R/R0R8R:(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR;Js tACLcBseZdÑZRS(ccsJt|dÉVt|dÉVt|dÉVt|dÉVt|dÉVdS(Nt types_allowedt display_nametpathnames reserved[](RR3(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8Zs (R/R0R8(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR?YstItemcBseZdÑZdÑZRS(ccsZt|dÉVt|dÉVt|dÉVx)t|diÉD]}t|dÉVq>WdS(NtidR=t attr_countsattr[](RtxrangeR7R;(R"tindex((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8bs cCsd|di|difS(NsItem #%s: %s attributesRDRE(R7(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR:is(R/R0R8R:(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRCas tItemscBseZdÑZRS(ccs>t|dÉVx)t|diÉD]}t|dÉVq"WdS(Ntcountsitem[](RRFR7RC(R"RG((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8ms(R/R0R8(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRHlst EncryptedItemcBseZdÑZRS(ccs„t|dÉVt|dÉVt|dÉVt|dÉVt|dÉVx"tdÉD]}t|dÉVqSWt|dÉVx)t|diÉD]}t|dÉVqçWt|d ÉVx)t|d iÉD]}t|d ÉVq«WdS( NRAtsecrettmtimetctimes reserved[]iREsattr[]t acl_countsacl[](R3R RFRR7R;R?(R"RG((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8ss  (R/R0R8(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRJrst EncryptedDatacBs;eZhdd6d d6dd6ZeZdÑZdÑZRS( tgnomeencryptedkeyringRDiitmin_sizeuGnome encrypted keyringt descriptioncCstS(N(tTrue(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pytvalidateåsccsät|ddÉVx@to8|i|id}|djoPnt|dÉVqWt|iddÉ}|ot|d|ÉVndS(Ntmd5iiiMsitem[]t padding_align(R RSR-t current_sizeRJRR(R"R-((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8ès iÄ(R/R0t PARSER_TAGSRtendianRTR8(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyROÖs  t GnomeKeyringcBsreZdZhdd6dd6edffd6dd 6d d 6Zhd d6Zhd d6ZeZdÑZdÑZ RS(sGnomeKeyring t gnomekeyringRDtmisctcategoryitmagici/iRQu Gnome keyringRRuAELuMD5cCs1|iidt|iÉÉ|ijodStS(NiuInvalid magic string(R#t readBytestlentMAGICRS(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRT¨s(ccsKt|dt|iÉd|iddÉVt|dÉVt|dÉVtt|dÉ|iÉVtt|dÉ|iÉVt|d ÉVt|d ÉVt|d ÉVt |d ÉVt |d ddÉVt |dÉVt |dÉVt |ddÉVt |d dÉVt|dÉVt |dÉVtt|d|diddtÉÉVdS(NR^sMagic string (%r)R6tASCIIt major_versiont minor_versiontcryptoRt keyring_nameRLRMt lock_on_idles reserved[]isReserved for future flagst lock_timeoutR$R&iititemstencrypted_sizet encrypteds AES128 CBCt parser_class(RR`RaRR t CRYPTO_NAMESt HASH_NAMESR3R RRRR RRHR2RR7RO(R"((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyR8±s"*ix( R/R0RaRXRmRnRRYRTR8(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRZös    cCsIt||É}x$t|dÉD]}t|É}q!W|d |dfS(Nii(RRF(R%R&R$tshaRG((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyRƒs (('t__doc__thachoir_core.toolsRthachoir_parserRthachoir_core.fieldRRRRRRRR R R R R Rthachoir_core.endianRtsysRRRRt Crypto.CipherRRR2R3R;R?RCRHRJRORZR(((sK/pentest/enumeration/google/metagoofil/hachoir_parser/misc/gnome_keyring.pyt<module> s2X    *
10,239
Python
.py
42
242.619048
1,588
0.462534
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,693
gnome_keyring.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/gnome_keyring.py
""" Gnome keyring parser. Sources: - Gnome Keyring source code, function generate_file() in keyrings/gkr-keyring.c, Author: Victor Stinner Creation date: 2008-04-09 """ from hachoir_core.tools import paddingSize from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Bit, NullBits, NullBytes, UInt8, UInt32, String, RawBytes, Enum, PascalString32, TimestampUnix64, CompressedField, SubFile) from hachoir_core.endian import BIG_ENDIAN from sys import hexversion try: import hashlib def sha256(data): hash = hashlib.new('sha256') hash.update(data) return hash.digest() except ImportError: def sha256(data): raise ImportError("hashlib module is missing") try: from Crypto.Cipher import AES class DeflateStream: def __init__(self, stream): hash_iterations = 1234 password = "x" * 8 salt = "\0" * 8 key, iv = generate_key(password, salt, hash_iterations) self.cipher = AES.new(key, AES.MODE_CBC, iv) def __call__(self, size, data=None): if data is None: return '' return self.cipher.decrypt(data) def Deflate(field): CompressedField(field, DeflateStream) return field except ImportError: def Deflate(field): return field class KeyringString(FieldSet): def createFields(self): yield UInt32(self, "length") length = self["length"].value if length == 0xffffffff: return yield String(self, "text", length, charset="UTF-8") def createValue(self): if "text" in self: return self["text"].value else: return u'' def createDescription(self): if "text" in self: return self["text"].value else: return u"(empty string)" class Attribute(FieldSet): def createFields(self): yield KeyringString(self, "name") yield UInt32(self, "type") type = self["type"].value if type == 0: yield KeyringString(self, "value") elif type == 1: yield UInt32(self, "value") else: raise TypeError("Unknown attribute type (%s)" % type) def createDescription(self): return 'Attribute "%s"' % self["name"].value class ACL(FieldSet): def createFields(self): yield UInt32(self, "types_allowed") yield KeyringString(self, "display_name") yield KeyringString(self, "pathname") yield KeyringString(self, "reserved[]") yield UInt32(self, "reserved[]") class Item(FieldSet): def createFields(self): yield UInt32(self, "id") yield UInt32(self, "type") yield UInt32(self, "attr_count") for index in xrange(self["attr_count"].value): yield Attribute(self, "attr[]") def createDescription(self): return "Item #%s: %s attributes" % (self["id"].value, self["attr_count"].value) class Items(FieldSet): def createFields(self): yield UInt32(self, "count") for index in xrange(self["count"].value): yield Item(self, "item[]") class EncryptedItem(FieldSet): def createFields(self): yield KeyringString(self, "display_name") yield KeyringString(self, "secret") yield TimestampUnix64(self, "mtime") yield TimestampUnix64(self, "ctime") yield KeyringString(self, "reserved[]") for index in xrange(4): yield UInt32(self, "reserved[]") yield UInt32(self, "attr_count") for index in xrange(self["attr_count"].value): yield Attribute(self, "attr[]") yield UInt32(self, "acl_count") for index in xrange(self["acl_count"].value): yield ACL(self, "acl[]") # size = 8 # paddingSize((self.stream.size - self.current_size) // 8, 16) # if size: # yield NullBytes(self, "hash_padding", size, "16 bytes alignment") class EncryptedData(Parser): PARSER_TAGS = { "id": "gnomeencryptedkeyring", "min_size": 16*8, "description": u"Gnome encrypted keyring", } endian = BIG_ENDIAN def validate(self): return True def createFields(self): yield RawBytes(self, "md5", 16) while True: size = (self.size - self.current_size) // 8 if size < 77: break yield EncryptedItem(self, "item[]") size = paddingSize(self.current_size // 8, 16) if size: yield NullBytes(self, "padding_align", size) class GnomeKeyring(Parser): MAGIC = "GnomeKeyring\n\r\0\n" PARSER_TAGS = { "id": "gnomekeyring", "category": "misc", "magic": ((MAGIC, 0),), "min_size": 47*8, "description": u"Gnome keyring", } CRYPTO_NAMES = { 0: u"AEL", } HASH_NAMES = { 0: u"MD5", } endian = BIG_ENDIAN def validate(self): if self.stream.readBytes(0, len(self.MAGIC)) != self.MAGIC: return u"Invalid magic string" return True def createFields(self): yield String(self, "magic", len(self.MAGIC), 'Magic string (%r)' % self.MAGIC, charset="ASCII") yield UInt8(self, "major_version") yield UInt8(self, "minor_version") yield Enum(UInt8(self, "crypto"), self.CRYPTO_NAMES) yield Enum(UInt8(self, "hash"), self.HASH_NAMES) yield KeyringString(self, "keyring_name") yield TimestampUnix64(self, "mtime") yield TimestampUnix64(self, "ctime") yield Bit(self, "lock_on_idle") yield NullBits(self, "reserved[]", 31, "Reserved for future flags") yield UInt32(self, "lock_timeout") yield UInt32(self, "hash_iterations") yield RawBytes(self, "salt", 8) yield NullBytes(self, "reserved[]", 16) yield Items(self, "items") yield UInt32(self, "encrypted_size") yield Deflate(SubFile(self, "encrypted", self["encrypted_size"].value, "AES128 CBC", parser_class=EncryptedData)) def generate_key(password, salt, hash_iterations): sha = sha256(password+salt) for index in xrange(hash_iterations-1): sha = sha256(sha) return sha[:16], sha[16:]
6,298
Python
.py
176
28.164773
121
0.613416
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,694
ttf.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/ttf.pyc
—Ú Œ »Mc@s.dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZddklZddklZlZlZdZdZdZhd d 6d d 6d d6dd6dd6Zhdd 6dd 6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56Zhd6d 6d7d 6d8d6d9d6d:d6Zhhd;d6d 6hd<d 6d 6hd;d 6d6Zd=efd>ÑÉYZd?efd@ÑÉYZdAÑZ dBÑZ!dCefdDÑÉYZ"dEefdFÑÉYZ#dGS(Hs TrueType Font parser. Documents: - "An Introduction to TrueType Fonts: A look inside the TTF format" written by "NRSI: Computers & Writing Systems" http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=IWS-Chapter08 Author: Victor Stinner Creation date: 2007-02-08 iˇˇˇˇ(tParser( tFieldSett ParserErrortUInt16tUInt32tBittBitst PaddingBitst NullBytestStringtRawBytestBytestEnumtTimestampMac32(t BIG_ENDIAN(t textHandlert hexadecimaltfilesizeHandleri,iiuMixed directionaliu Left to rightiuLeft to right + neutralsiu Right to leftuRight to left + neutralsi˛ˇˇˇuCopyright noticeuFont family nameuFont subfamily nameuUnique font identifieruFull font nameiuVersion stringiuPostscript nameiu TrademarkiuManufacturer nameiuDesigneri u Descriptioni u URL Vendori u URL Designeri uLicense Descriptioni uLicense info URLiuPreferred FamilyiuPreferred SubfamilyiuCompatible Fulliu Sample textiuPostScript CID findfont nameitUnicodet MacintoshtISOt MicrosofttCustoms UTF-16-BEtMacRomant TableHeadercBseZdÑZdÑZRS(ccsNt|ddÉVtt|dÉtÉVt|dÉVtt|dÉÉVdS(Nttagitchecksumtoffsettsize(R RRRR(tself((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyt createFieldsIscCsd|di|difS(NsTable entry: %s (%s)RR(tdisplay(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pytcreateDescriptionOs(t__name__t __module__RR (((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyRHs t NameHeadercBs#eZdÑZdÑZdÑZRS(ccsjtt|dÉtÉVt|dÉVt|dÉVtt|dÉtÉVt|dÉVt|dÉVdS(Nt platformIDt encodingIDt languageIDtnameIDtlengthR(R Rt PLATFORM_NAMEt NAMEID_NAME(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyRSs cCs\|di}|di}yt||SWn+tj o|id||fÉdSXdS(NR$R%sTTF: Unknown charset (%s,%s)s ISO-8859-1(tvaluet CHARSET_MAPtKeyErrortwarning(Rtplatformtencoding((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyt getCharset[s  cCs(|di}|di}d||fS(NR$R'sName record: %s (%s)(R(RR/tname((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyR ds  (R!R"RR1R (((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyR#Rs  ccs&t|ddÉVt|ddÉVt|ddÉVt|ddÉVtt|d ÉtÉVt|d d d ÉV|d id jotdÉÇnt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|ddÉVt|dd ÉVt|d!d"ÉVt|d#d$ÉVt|d%d&ÉVt|d'd(ÉVt|d)d*ÉVt |d+d,d-ÉVt|d.d/ÉVd0|d.ijo d1jnptd2ÉÇnt|d3ÉVt |d4ÉVt|d5ÉVt |d6ÉVt|d7ÉVt|d8ÉVt|d9ÉVt|d:ÉVt|d;ÉVt|d<ÉVt|d=ÉVt|d>ÉVt|d?ÉVt|d@dAÉVt|dBÉVt|ddCÉVt|dDdEÉVt t|dFdGÉt ÉVt t|dHÉhdIdJ6dKd6ÉVt|dLdMÉVdS(NNtmaj_vers Major versiontmin_vers Minor versiont font_maj_versFont major versiont font_min_versFont minor versionRtmagicisMagic string (\x5F\x0F\x3C\xF5)s_<ıs!TTF: invalid magic of font headerty0sBaseline at y=0tx0sLeft sidebearing point at x=0t instr_points%Instructions may depend on point sizetppems$Force PPEM to integer values for allt instr_widths$Instructions may alter advance widthtverticalse laid out vertically?s reserved[]it linguistics1Requires layout for correct linguistic rendering?tgxsMetamorphosis effects?tstrongs%Contains strong right-to-left glyphs?tindics+contains Indic-style rearrangement effects?tlosslesss-Data is lossless (Agfa MicroType compression)t converteds+Font converted (produce compatible metrics)t cleartypesOptimised for ClearTypetadobeis(used by Adobe)t unit_per_ems Units per emii@sTTF: Invalid unit/em valuet created_hightcreatedt modified_hightmodifiedtxmintymintxmaxtymaxtboldtitalict underlinetoutlinetshadowt condenseds(narrow)texpandedi tlowests Smallest readable size in pixelstfont_dirsFont direction hintt ofst_formats short offsetsitlongt glyph_formats(=0)( RRRRR R+RRRRR R tDIRECTION_NAME(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pytparseFontHeaderis\%%c csAt|dÉV|didjotd|diÉÇnt|dÉVt|dÉVt|dijotd|diÉÇng}x<t|diÉD]'}t|dÉ}|V|i|Éq¢W|idd ÑÉd}x$|D]}|di|d if}|o.||jo!|i d |i |fÉqÌn|di|d if}|di|di}||i d jo|i d |i ÉqÌn|i |dt dt É}|o |Vn|d i}|o't|d||id|iÉÉVqÌqÌW|i|i d }|ot|d|ÉVndS(Ntformatis TTF (names): Invalid format (%u)tcountRsInvalid number of names (%s)sheader[]tkeycSs |diS(R(R+(tfield((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyt<lambda>≤sR(sSkip duplicate %s %sisSkip value %s (negative offset)trelativetnullsvalue[]tcharsett padding_end(RR+RtMAX_NAME_COUNTtxrangeR#tappendtsorttNoneR.R2t current_sizetseekBytetTrueR t descriptionR1RR( RtentriestindextentrytlasttnewRtpaddingR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyt parseNamesüsH  +tTablecBsIeZhddefd6ddefd6ZdÑZdÑZdÑZRS( theaders Font headertheadtnamestNamesR2cKslti||||ç||_|di}||ijo#|i|\|_|_|_n d|_dS(NR( Rt__init__ttableR+tTAG_INFOt_namet _descriptiontparserRj(RtparentR2R|tkwR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyR{ÿs   #ccsI|io#x8|i|ÉD] }|VqWnt|d|idÉVdS(Ntcontenti(RÄR R(RR`((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyR·s   cCsd|idi|iifS(Ns Table %s (%s)R(R|R+tpath(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyR Ës(R!R"R\RuR}R{RR (((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyRv“s  tTrueTypeFontFilecBsIeZeZhdd6dd6d d6d d6dd 6Zd ÑZd ÑZRS(tttftidtmisctcategorytfile_exti itmin_sizes TrueType fontRncCsÅ|didjod|diS|didjod|diSt|dijo tjnpd|diStS( NR3isInvalid major version (%u)R4isInvalid minor version (%u)tnb_tablesInvalid number of table (%u)(R+t MIN_NB_TABLEt MAX_NB_TABLERm(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pytvalidateıs%c csNt|ddÉVt|ddÉVt|dÉVt|dÉVt|dÉVt|dÉVg}x<t|diÉD]'}t|d É}|V|i|ÉqtW|id d ÑÉxm|D]e}|i|d id tÉ}|o |Vn|di}|ot|d|d|dÉVqπqπW|i |i d tÉ}|o |VndS(NR3s Major versionR4s Minor versionRåt search_rangetentry_selectort range_shifts table_hdr[]R_cSs |diS(R(R+(R`((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyRa sRRcRstable[]i( RRgR+RRhRiRlRmRvtseekBitR(RttablesRpR|RtR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyR˛s0  #(RÜiP(R!R"Rtendiant PARSER_TAGSRèR(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyRÖÎs  N($t__doc__thachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R thachoir_core.endianRthachoir_core.text_handlerRRRRfRçRéR[R*R)R,RR#R\RuRvRÖ(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/ttf.pyt<module> sdX     6 3
11,249
Python
.py
59
189.508475
1,149
0.471892
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,695
pcf.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/pcf.py
""" X11 Portable Compiled Font (pcf) parser. Documents: - Format for X11 pcf bitmap font files http://fontforge.sourceforge.net/pcf-format.html (file is based on the X11 sources) Author: Victor Stinner Creation date: 2007-03-20 """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, Enum, UInt8, UInt32, Bytes, RawBytes, NullBytes, Bit, Bits, PaddingBits, CString) from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_core.text_handler import textHandler, hexadecimal, filesizeHandler from hachoir_core.tools import paddingSize class TOC(FieldSet): TYPE_NAME = { 0x00000001: "Properties", 0x00000002: "Accelerators", 0x00000004: "Metrics", 0x00000008: "Bitmaps", 0x00000010: "Ink metrics", 0x00000020: "BDF encodings", 0x00000040: "SWidths", 0x00000080: "Glyph names", 0x00000100: "BDF accelerators", } FORMAT_NAME = { 0x00000000: "Default", 0x00000200: "Ink bounds", 0x00000100: "Accelerator W ink bounds", # 0x00000200: "Compressed metrics", } def createFields(self): yield Enum(UInt32(self, "type"), self.TYPE_NAME) yield UInt32(self, "format") yield filesizeHandler(UInt32(self, "size")) yield UInt32(self, "offset") def createDescription(self): return "%s at %s (%s)" % ( self["type"].display, self["offset"].value, self["size"].display) class PropertiesFormat(FieldSet): static_size = 32 endian = LITTLE_ENDIAN def createFields(self): yield Bits(self, "reserved[]", 2) yield Bit(self, "byte_big_endian") yield Bit(self, "bit_big_endian") yield Bits(self, "scan_unit", 2) yield textHandler(PaddingBits(self, "reserved[]", 26), hexadecimal) class Property(FieldSet): def createFields(self): yield UInt32(self, "name_offset") yield UInt8(self, "is_string") yield UInt32(self, "value_offset") def createDescription(self): # FIXME: Use link or any better way to read name value name = self["../name[%s]" % (self.index-2)].value return "Property %s" % name class GlyphNames(FieldSet): def __init__(self, parent, name, toc, description, size=None): FieldSet.__init__(self, parent, name, description, size=size) self.toc = toc if self["format/byte_big_endian"].value: self.endian = BIG_ENDIAN else: self.endian = LITTLE_ENDIAN def createFields(self): yield PropertiesFormat(self, "format") yield UInt32(self, "count") offsets = [] for index in xrange(self["count"].value): offset = UInt32(self, "offset[]") yield offset offsets.append(offset.value) yield UInt32(self, "total_str_length") offsets.sort() offset0 = self.current_size // 8 for offset in offsets: padding = self.seekByte(offset0+offset) if padding: yield padding yield CString(self, "name[]") padding = (self.size - self.current_size) // 8 if padding: yield NullBytes(self, "end_padding", padding) class Properties(GlyphNames): def createFields(self): yield PropertiesFormat(self, "format") yield UInt32(self, "nb_prop") properties = [] for index in xrange(self["nb_prop"].value): property = Property(self, "property[]") yield property properties.append(property) padding = paddingSize(self.current_size//8, 4) if padding: yield NullBytes(self, "padding", padding) yield UInt32(self, "total_str_length") properties.sort(key=lambda entry: entry["name_offset"].value) offset0 = self.current_size // 8 for property in properties: padding = self.seekByte(offset0+property["name_offset"].value) if padding: yield padding yield CString(self, "name[]", "Name of %s" % property.name) if property["is_string"].value: yield CString(self, "value[]", "Value of %s" % property.name) padding = (self.size - self.current_size) // 8 if padding: yield NullBytes(self, "end_padding", padding) class PcfFile(Parser): MAGIC = "\1fcp" PARSER_TAGS = { "id": "pcf", "category": "misc", "file_ext": ("pcf",), "magic": ((MAGIC, 0),), "min_size": 32, # FIXME "description": "X11 Portable Compiled Font (pcf)", } endian = LITTLE_ENDIAN def validate(self): if self["signature"].value != self.MAGIC: return "Invalid signature" return True def createFields(self): yield Bytes(self, "signature", 4, r'File signature ("\1pcf")') yield UInt32(self, "nb_toc") entries = [] for index in xrange(self["nb_toc"].value): entry = TOC(self, "toc[]") yield entry entries.append(entry) entries.sort(key=lambda entry: entry["offset"].value) for entry in entries: size = entry["size"].value padding = self.seekByte(entry["offset"].value) if padding: yield padding maxsize = (self.size-self.current_size)//8 if maxsize < size: self.warning("Truncate content of %s to %s bytes (was %s)" % (entry.path, maxsize, size)) size = maxsize if not size: continue if entry["type"].value == 1: yield Properties(self, "properties", entry, "Properties", size=size*8) elif entry["type"].value == 128: yield GlyphNames(self, "glyph_names", entry, "Glyph names", size=size*8) else: yield RawBytes(self, "data[]", size, "Content of %s" % entry.path)
5,994
Python
.py
153
30.352941
105
0.600446
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,696
lnk.pyc
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/lnk.pyc
Ñò Î ÈMc @s·dZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZlZlZlZddklZddklZlZddklZddklZlZddklZdd klZd efd „ƒYZ d efd „ƒYZ!d„Z"defd„ƒYZ#defd„ƒYZ$defd„ƒYZ%defd„ƒYZ&defd„ƒYZ'de fd„ƒYZ(defd„ƒYZ)hdd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6Z*d[„Z+d\efd]„ƒYZ,d^S(_sè Windows Shortcut (.lnk) parser. Documents: - The Windows Shortcut File Format (document version 1.0) Reverse-engineered by Jesse Hager http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Format.pdf - Wine source code: http://source.winehq.org/source/include/shlobj.h (SHELL_LINK_DATA_FLAGS enum) http://source.winehq.org/source/dlls/shell32/pidl.h - Microsoft: http://msdn2.microsoft.com/en-us/library/ms538128.aspx Author: Robert Xiao, Victor Stinner Changes: 2007-06-27 - Robert Xiao * Fixes to FileLocationInfo to correctly handle Unicode paths 2007-06-13 - Robert Xiao * ItemID, FileLocationInfo and ExtraInfo structs, correct Unicode string handling 2007-03-15 - Victor Stinner * Creation of the parser iÿÿÿÿ(tParser(tFieldSettCStringtStringtUInt32tUInt16tUInt8tBittBitst PaddingBitstTimestampWin64tDateTimeMSDOS32t NullBytest PaddingBytestRawBytestEnum(t LITTLE_ENDIAN(t textHandlert hexadecimal(tGUID(tMSDOSFileAttr16tMSDOSFileAttr32(tfilesizeHandler(t paddingSizet ItemIdListcBseZd„Zd„ZRS(cOs/ti|||Ž|didd|_dS(Ntsizeii(Rt__init__tvaluet_size(tselftargstkw((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR)sccsKt|ddƒVx3to+t|dƒ}|V|dipPqqWdS(NRsSize of item ID listsitemid[]tlength(RtTruetItemIdR(Rtitem((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyt createFields-s(t__name__t __module__RR$(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR(s R"cBs§eZhdd6dd6dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6Zd „Zd!„Zd"„ZRS(#RitDrivei#i%i)i.i/sDir/Filei0t Directoryi1tFilei2sFile [Unicode Name]i4t WorkgroupiAtComputeriBs Net ProvideriFs Whole NetworkiGt MSITStoreiasPrinter/RAS ConnectionipsHistory/Favoritei±s Network ShareiÃcOsFti|||Ž|dio|did|_n d|_dS(NR ii(RRRR(RRR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRKsccsêt|ddƒV|dipdStt|dƒ|iƒV|di}|d8jo&t|ddd ƒVt|d ƒVni|d9jo&t|d|didddƒVn6|d:jo0t|dddƒVt|ddƒVt |ddƒVt |ddƒVt |ddƒV|i i ƒo³t|idd ƒ}|ot|d!|ƒVnt|d"d#ƒVt|d$d%ƒVt |d&d'ƒVt |d(d)ƒVt|d$d*ƒVt |d+dd,d-ƒVt|d$d ƒVqæt |d.d/ƒVnù|d;joBt|d$d ƒVt |dƒVt |d3ƒVt|d$d ƒVnª|d4jo#t|d$d ƒVt |dƒVnz|d5joPt|d$d ƒVt |dƒVt |d3ƒVt |d6ƒVt|d$d ƒVnt|d7|didƒVdS(<NR sLength of Item ID Entryttypeii.iptdummyisshould be 0x50tguidi#i%i)i/tdriveitstripti0i1i2sshould be 0x00Rssize of file; 0 for folderst date_timesFile/folder date and timetattribssFile/folder attributestnamesFile/folder nameiitpadtlength_wsLength of wide struct members unknown[]itcreation_date_times"File/folder creation date and timetaccess_date_times%File/folder last access date and timeit unicode_nametcharsets UTF-16-LEt name_shortsFile/folder short nameiAiBiFtprotocoliGiÃt descriptiontraw(ii.ip(i#i%i)i/(i0i1i2(iAiBiF(RRRRt ITEM_TYPERRRRR RRtrootthasUnicodeNamesRt current_sizeR (Rt entrytypetn((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$RsV   &    cCs5|diod|ii|didƒSdSdS(NR sItem ID Entry: R-tUnknownsEnd of Item ID List(RR@tget(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pytcreateDescriptionŽs(R%R&R@RR$RH(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR"5s,   <cCs|i}d|d?|d@fS(Ns %04X-%04Xiiÿÿ(R(tfieldtval((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pytformatVolumeSerial”s tLocalVolumeTablecBsSeZhdd6dd6dd6dd6dd 6d d 6Zd „Zd „Zd„ZRS(sNo root directoryisRemovable (Floppy, Zip, etc.)isFixed (Hard disk)isRemote (Network drive)isCD-ROMis Ram driveiccs‘t|ddƒVtt|ddƒ|iƒVtt|ddƒtƒVt|ddƒV|i|diƒ}|o |Vnt|d ƒVdS( NR sLength of this structuret volume_types Volume Typet volume_serialsVolume Serial Numbert label_offsetsOffset to volume labelR0(RRt VOLUME_TYPERRKtseekByteRR(Rtpadding((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$¢s cCst|diƒS(NR0(tboolR(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pythasValue­scCs |diS(NR0(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyt createValue°s(R%R&RPR$RTRU(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRL˜s  tNetworkVolumeTablecBseZd„Zd„ZRS(ccs„t|ddƒVt|dƒVt|ddƒVt|dƒVt|dƒV|i|diƒ}|o |Vnt|dƒVdS(NR sLength of this structures unknown[]tshare_name_offsetsOffset to share namet share_name(RRQRR(RRR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$´s cCs |diS(NRX(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRU¿s(R%R&R$RU(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRV³s tFileLocationInfocBseZd„ZRS(ccs�t|ddƒV|dipdSt|ddƒV|didj}t|dƒVt|dƒVt|dd ƒVt|d d ƒVt|d d ƒVt|ddƒVt|ddƒV|o&t|ddƒVt|ddƒVn|dioº|i|d iƒ}|o |Vnt|ddƒV|i|d iƒ}|o |Vnt|ddƒV|oA|i|diƒ}|o |Vnt|ddddƒVq®n|dio8|i|diƒ}|o |Vnt|dƒVn|i|diƒ}|o |Vnt|dd ƒV|oA|i|diƒ}|o |Vnt|d!d"ddƒVn|i|diƒ}|o |VndS(#NR sLength of this structuretfirst_offset_possPosition of first offseti$ton_local_volumeton_network_volumes reserved[]itlocal_info_offsetsDOffset to local volume table; only meaningful if on_local_volume = 1tlocal_pathname_offsetsEOffset to local base pathname; only meaningful if on_local_volume = 1tremote_info_offsetsHOffset to network volume table; only meaningful if on_network_volume = 1tpathname_offsetsOffset of remaining pathnametlocal_pathname_unicode_offsetsXOffset to Unicode version of local base pathname; only meaningful if on_local_volume = 1tpathname_unicode_offsets/Offset to Unicode version of remaining pathnametlocal_volume_tablesLocal Volume Tabletlocal_base_pathnamesLocal Base Pathnametlocal_base_pathname_unicodesLocal Base Pathname in UnicodeR;s UTF-16-LEtnetwork_volume_tabletfinal_pathnamesFinal component of the pathnametfinal_pathname_unicodes*Final component of the pathname in Unicode(RRRR RQRLRRV(Rthas_unicode_pathsRR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$Ãs\      (R%R&R$(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRYÂst LnkStringcBseZd„Zd„ZRS(ccsit|ddƒV|iiƒo&t|d|didddƒVnt|d|diddƒVdS(NR sLength of this stringtdataiR;s UTF-16-LEtASCII(RRARBRR(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$ús&cCs |diS(NRk(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRUs(R%R&R$RU(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRjùs tColorRefcBs&eZdZdZd„Zd„ZRS(s COLORREF struct, 0x00bbggrr i ccsKt|ddƒVt|ddƒVt|ddƒVt|ddd ƒVdS( NtredtRedtgreentGreentbluetBlueR6isPadding (must be 0)(RR (R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$scCs,|di|di|dif}d|S(NRnRpRrsRGB Color: #%02X%02X%02X(R(Rtrgb((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRH s$(R%R&t__doc__t static_sizeR$RH(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRms tColorTableIndexcBseZdd„Zd„ZRS(cCs&ti||||dƒ||_dS(N(RRtNonetdesc(RtparentR5RR>((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRscCsIt|dƒot|dƒpt‚d|i|id|iifS(NRzRs%s: %ss color[%i](thasattrtAssertionErrorRyRzRR>(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRHs' N(R%R&RxRRH(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRws t ExtraInfocBsîeZhdd6dd6dd6dd6dd 6d d 6d d 6Zh6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dRdS6dTdU6dVdW6dXdY6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dldm6dndo6dpdq6drds6dtdu6dvdw6dxdy6Zhdzd6d{d6Zd|„Zd}„Zd~„ZRS(sLink Target Informationl@sConsole Window Propertiesl@sHostname and Other Stuffl@sConsole Codepage Informationl@sSpecial Folder Infol@s+DarwinID (Windows Installer ID) Informationl@sCustom Icon Detailsl@tDESKTOPitINTERNETitPROGRAMSitCONTROLSitPRINTERSitPERSONALit FAVORITESitSTARTUPitRECENTitSENDTOi t BITBUCKETi t STARTMENUi tDESKTOPDIRECTORYitDRIVESitNETWORKitNETHOODitFONTSit TEMPLATESitCOMMON_STARTMENUitCOMMON_PROGRAMSitCOMMON_STARTUPitCOMMON_DESKTOPDIRECTORYitAPPDATAit PRINTHOODit LOCAL_APPDATAit ALTSTARTUPitCOMMON_ALTSTARTUPitCOMMON_FAVORITESitINTERNET_CACHEi tCOOKIESi!tHISTORYi"tCOMMON_APPDATAi#tWINDOWSi$tSYSTEMi%t PROGRAM_FILESi&t MYPICTURESi'tPROFILEi(t SYSTEMX86i)tPROGRAM_FILESX86i*tPROGRAM_FILES_COMMONi+tPROGRAM_FILES_COMMONX86i,tCOMMON_TEMPLATESi-tCOMMON_DOCUMENTSi.tCOMMON_ADMINTOOLSi/t ADMINTOOLSi0t CONNECTIONSi1t COMMON_MUSICi5tCOMMON_PICTURESi6t COMMON_VIDEOi7t RESOURCESi8tRESOURCES_LOCALIZEDi9tCOMMON_OEM_LINKSi:t CDBURN_AREAi;tCOMPUTERSNEARMEi=tFalseR!cOsFti|||Ž|dio|did|_n d|_dS(NR ii (RRRR(RRR((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR`sc cs§t|ddƒV|dipdSttt|ddƒtƒ|iƒV|didjo\t|dƒVt|dƒVt|dd d d d ƒVt|dd ƒVt|dd ƒVnê|didjo2tt|ddƒ|iƒVt|ddƒVn¤|did]joð|didjo d}n%|didjo d}nd}t ||dddƒV|di|i dd^}|ot|d|d ƒVnt ||d!d"dd#d$d ƒV|di|i d}|ot|d|d ƒVq£n |did%jo?t |d&d'd(ƒVt |d)d'd*ƒVt |d+d,ƒVt |d-d'd.ƒVt |d/d'd0ƒVt |d+d,ƒVt |d1d2ƒVt |d3d4ƒVt |d5d6ƒVt |d7d8ƒVt |d9d:ƒVt |d;d<ƒVt|d=ƒVt|d>ƒVt |d?d@ƒVt |dAdBƒVt|dCƒVt|dDƒVt|dEdFdGdd#d$d ƒVt|dHdIƒVtt|dJdKƒ|iƒVtt|dLdMƒ|iƒVtt|dNdOƒ|iƒVtt|dPdQƒ|iƒVt|dRdSƒVt|dTdUƒVtt|dVdWƒ|iƒVxrtd ƒD]}t|dXƒVq;WnM|didYjot|dZd[ƒVn$t|d\|di|i dƒVdS(_NR sLength of this structuret signatures4Signature determining the function of this structurel@tremaining_lengths unknown[]thostnameis5Computer hostname on which shortcut was last modifiedR1R2i l@tspecial_folder_idsID of the special foldertoffsetsOffset to Item ID entryl@l@l@ttargettdarwinIDt icon_pathsData (ASCII format)R;Rliiis slack_space[]sData beyond end of stringt_unicodesData (Unicode format)s UTF-16-LEttruncatel@t color_textisScreen text color indextcolor_bgsScreen background color indexs reserved[]itcolor_popup_textsPop-up text color indextcolor_popup_bgsPop-up background color indext buffer_widths%Screen buffer width (character cells)t buffer_heights&Screen buffer height (character cells)t window_widthsWindow width (character cells)t window_heightsWindow height (character cells)t position_lefts.Window distance from left edge (screen coords)t position_tops-Window distance from top edge (screen coords)t font_numbertinput_buffer_sizet font_widths-Font width in pixels; 0 for a non-raster fontt font_heightsBFont height in pixels; equal to the font size for non-raster fontst font_familyt font_weighttfont_name_unicodei@sFont Name (Unicode format)t cursor_sizes-Relative size of cursor (% of character size)t full_screensRun console in full screen?t quick_edits=Console uses quick-edit feature (using mouse to cut & paste)?t insert_modesConsole uses insertion mode?t auto_positions&System automatically positions window?t history_sizes%Size of the history buffer (in lines)t history_countsBNumber of history buffers (each process gets one up to this limit)thistory_no_dups>Automatically eliminate duplicate lines in the history buffer?scolor[]l@tcodepagesConsole's code pageR?(l@l@l@i(RRRRRt INFO_TYPERRtSPECIAL_FOLDERRRCRwR Rt BOOL_ENUMtxrangeRm(Rt object_namet remainingtindex((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$gsz&  !  cCs&|diod|diSdSdS(NR sExtra Info Entry: RµsEnd of Extra Info(Rtdisplay(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRH²s(R%R&RÙRÚRÛRR$RH(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR}sŠ     KuNoneiuPauseiu Caps LockiuPage Upi!u Page Downi"uEndi#uHomei$uLefti%uUpi&uRighti'uDowni(uInserti-uDeletei.uNum *ijuNum +ikuNum -imuNum .inuNum /iouNum Locki�u Scroll Locki‘u;iºu=i»u,i¼u-i½u.i¾u/i¿u`iÀu[iÛu\iÜu]iÝu'iÞcCsît|dƒpt‚|i}d|jo djno t|ƒSd|jo djno t|ƒSd|jo djnodt|dƒSd |jo d jno d |d S|tjo t|St|ƒS( NRi0i9iAiZi`iiu Numpad %cipi‡sF%iio(R{R|RtunichrtHOT_KEYStstr(RIRJ((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyt text_hot_keyÚs      tLnkFilecBsÌeZdZhdd6dd6d%d6d&d6edffd 6eeƒd d 6d d 6ZeZh dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd6d d!6Zd"„Zd#„Z d$„Z RS('tLÀFtlnktidtmisctcategorytfile_extuapplication/x-ms-shortcuttmimeitmagicitmin_sizesWindows Shortcut (.lnk)R>uHideu Show NormaliuShow MinimizediuShow MaximizediuShow Normal, not activatediuShowiuMinimizeiuShow Minimized, not activatediuShow, not activateduRestorei u Show Defaulti cCs6|didjodS|didjodStS(NRµiLsInvalid signatureR/s$00021401-0000-0000-C000-000000000046s Invalid GUID(RR!(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pytvalidates cCs |diS(Nthas_unicode_names(R(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRB sccsRt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d d ƒVt|d d ƒVt|d dƒVt|ddƒVt|ddƒVt|ddƒVt|dƒVt|dƒVt|dƒVt|ddƒVt|ddƒVt|ddƒVt|ddƒVt|d ƒVt|d!ƒVt|d"ƒVt|d#d$d%ƒVt|d&ƒVt|d'ƒVt|d(ƒVt|d)ƒVtt|d*ƒƒVt|d+ƒVtt|d,ƒ|iƒVt t |d-d.ƒt ƒVt|d/d0ƒVt|d1d2ƒVt|d3d4ƒVt|d5d6d7ƒVt |d#d8ƒV|di ot|d9d:ƒVn|di ot|d;d<ƒVn|d i ot|d=ƒVn|d i ot|d>d?ƒVn|d i ot|d@dAƒVn|di ot|dBdCƒVn|di ot|dDdEƒVnx|ipt|dFƒVq1WdS(GNRµsShortcut signature (0x0000004C)R/s4Shortcut GUID (00021401-0000-0000-C000-000000000046)t has_shell_idsIs the Item ID List present?ttarget_is_filesIs a file or a directory?thas_descriptions!Is the Description field present?t has_rel_paths-Is the relative path to the target available?thas_working_dirsIs there a working directory?thas_cmd_line_argss%Are there any command line arguments?thas_custom_iconsIs there a custom icon?RðsAre Unicode names used?tforce_no_linkinfot has_exp_sztrun_in_separatet has_logo3idsIs LOGO3 ID info present?t has_darwinidsIs the DarwinID info present?t runas_users"Is the target run as another user?thas_exp_icon_szs%Is custom icon information available?t no_pidl_aliastforce_unc_nametrun_with_shim_layers reserved[]is!Flag bits reserved for future uset target_attrt creation_timetmodification_timetlast_access_timettarget_filesizet icon_numbert show_windowthot_keysHot key used for quick accesst hot_key_shiftsHot key: is Shift used?t hot_key_ctrlsHot key: is Ctrl used?t hot_key_altsHot key: is Alt used?thot_key_reservedisHot key: (reserved)it item_idlists Item ID Listtfile_location_infosFile Location InfoR>t relative_pathsRelative path to targett working_dirs*Working directory (dir to start target in)t cmd_line_argssCommand Line Argumentst custom_iconsCustom Icon Paths extra_info[](RRRR RR RRtSHOW_WINDOW_STATERRRäR RRRYRjteofR}(R((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyR$sf (Rç(uapplication/x-ms-shortcut( R%R&tMAGICtlent PARSER_TAGSRtendianRRïRBR$(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyRåés2    N(-Ruthachoir_parserRthachoir_core.fieldRRRRRRRRR R R R R RRthachoir_core.endianRthachoir_core.text_handlerRRthachoir_parser.common.win32Rthachoir_parser.common.msdosRRRthachoir_core.toolsRRR"RKRLRVRYRjRmRwR}RâRäRå(((sA/pentest/enumeration/google/metagoofil/hachoir_parser/misc/lnk.pyt<module>shd _ 7   Ÿ  
24,903
Python
.py
82
302.317073
2,215
0.491962
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,697
__init__.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/__init__.py
from hachoir_parser.misc.file_3do import File3do from hachoir_parser.misc.file_3ds import File3ds from hachoir_parser.misc.torrent import TorrentFile from hachoir_parser.misc.ttf import TrueTypeFontFile from hachoir_parser.misc.chm import ChmFile from hachoir_parser.misc.lnk import LnkFile from hachoir_parser.misc.pcf import PcfFile from hachoir_parser.misc.ole2 import OLE2_File from hachoir_parser.misc.pdf import PDFDocument from hachoir_parser.misc.pifv import PIFVFile from hachoir_parser.misc.hlp import HlpFile from hachoir_parser.misc.gnome_keyring import GnomeKeyring from hachoir_parser.misc.bplist import BPList
626
Python
.py
13
47.076923
58
0.866013
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,698
msoffice_summary.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/msoffice_summary.py
""" Microsoft Document summaries structures. Documents --------- - Apache POI (HPSF Internals): http://poi.apache.org/hpsf/internals.html """ from hachoir_parser import HachoirParser from hachoir_core.field import (FieldSet, ParserError, RootSeekableFieldSet, SeekableFieldSet, Bit, Bits, NullBits, UInt8, UInt16, UInt32, TimestampWin64, TimedeltaWin64, Enum, Bytes, RawBytes, NullBytes, String, Int8, Int16, Int32, Float32, Float64, PascalString32) from hachoir_core.text_handler import textHandler, hexadecimal, filesizeHandler from hachoir_core.tools import createDict from hachoir_core.endian import LITTLE_ENDIAN, BIG_ENDIAN from hachoir_parser.common.win32 import GUID, PascalStringWin32 from hachoir_parser.image.bmp import BmpHeader, parseImageData MAX_SECTION_COUNT = 100 OS_MAC = 1 OS_NAME = { 0: "Windows 16-bit", 1: "Macintosh", 2: "Windows 32-bit", } class OSConfig: def __init__(self, big_endian): if big_endian: self.charset = "MacRoman" self.utf16 = "UTF-16-BE" else: # FIXME: Don't guess the charset, use ISO-8859-1 or UTF-8 #self.charset = "ISO-8859-1" self.charset = None self.utf16 = "UTF-16-LE" class PropertyIndex(FieldSet): TAG_CODEPAGE = 1 COMMON_PROPERTY = { 0: "Dictionary", 1: "CodePage", 0x80000000: "LOCALE_SYSTEM_DEFAULT", 0x80000003: "CASE_SENSITIVE", } DOCUMENT_PROPERTY = { 2: "Category", 3: "PresentationFormat", 4: "NumBytes", 5: "NumLines", 6: "NumParagraphs", 7: "NumSlides", 8: "NumNotes", 9: "NumHiddenSlides", 10: "NumMMClips", 11: "Scale", 12: "HeadingPairs", 13: "DocumentParts", 14: "Manager", 15: "Company", 16: "LinksDirty", 17: "DocSumInfo_17", 18: "DocSumInfo_18", 19: "DocSumInfo_19", 20: "DocSumInfo_20", 21: "DocSumInfo_21", 22: "DocSumInfo_22", 23: "DocSumInfo_23", } DOCUMENT_PROPERTY.update(COMMON_PROPERTY) COMPONENT_PROPERTY = { 2: "Title", 3: "Subject", 4: "Author", 5: "Keywords", 6: "Comments", 7: "Template", 8: "LastSavedBy", 9: "RevisionNumber", 10: "TotalEditingTime", 11: "LastPrinted", 12: "CreateTime", 13: "LastSavedTime", 14: "NumPages", 15: "NumWords", 16: "NumCharacters", 17: "Thumbnail", 18: "AppName", 19: "Security", } COMPONENT_PROPERTY.update(COMMON_PROPERTY) def createFields(self): if self["../.."].name.startswith("doc_summary"): enum = self.DOCUMENT_PROPERTY else: enum = self.COMPONENT_PROPERTY yield Enum(UInt32(self, "id"), enum) yield UInt32(self, "offset") def createDescription(self): return "Property: %s" % self["id"].display class Bool(Int8): def createValue(self): value = Int8.createValue(self) return (value == -1) class Thumbnail(FieldSet): """ Thumbnail. Documents: - See Jakarta POI http://jakarta.apache.org/poi/hpsf/thumbnails.html http://www.penguin-soft.com/penguin/developer/poi/ org/apache/poi/hpsf/Thumbnail.html#CF_BITMAP - How To Extract Thumbnail Images http://sparks.discreet.com/knowledgebase/public/ solutions/ExtractThumbnailImg.htm """ FORMAT_CLIPBOARD = -1 FORMAT_NAME = { -1: "Windows clipboard", -2: "Macintosh clipboard", -3: "GUID that contains format identifier", 0: "No data", 2: "Bitmap", 3: "Windows metafile format", 8: "Device Independent Bitmap (DIB)", 14: "Enhanced Windows metafile", } DIB_BMP = 8 DIB_FORMAT = { 2: "Bitmap Obsolete (old BMP)", 3: "Windows metafile format (WMF)", 8: "Device Independent Bitmap (BMP)", 14: "Enhanced Windows metafile (EMF)", } def __init__(self, *args): FieldSet.__init__(self, *args) self._size = self["size"].value * 8 def createFields(self): yield filesizeHandler(UInt32(self, "size")) yield Enum(Int32(self, "format"), self.FORMAT_NAME) if self["format"].value == self.FORMAT_CLIPBOARD: yield Enum(UInt32(self, "dib_format"), self.DIB_FORMAT) if self["dib_format"].value == self.DIB_BMP: yield BmpHeader(self, "bmp_header") size = (self.size - self.current_size) // 8 yield parseImageData(self, "pixels", size, self["bmp_header"]) return size = (self.size - self.current_size) // 8 if size: yield RawBytes(self, "data", size) class PropertyContent(FieldSet): TYPE_LPSTR = 30 TYPE_INFO = { 0: ("EMPTY", None), 1: ("NULL", None), 2: ("UInt16", UInt16), 3: ("UInt32", UInt32), 4: ("Float32", Float32), 5: ("Float64", Float64), 6: ("CY", None), 7: ("DATE", None), 8: ("BSTR", None), 9: ("DISPATCH", None), 10: ("ERROR", None), 11: ("BOOL", Bool), 12: ("VARIANT", None), 13: ("UNKNOWN", None), 14: ("DECIMAL", None), 16: ("I1", None), 17: ("UI1", None), 18: ("UI2", None), 19: ("UI4", None), 20: ("I8", None), 21: ("UI8", None), 22: ("INT", None), 23: ("UINT", None), 24: ("VOID", None), 25: ("HRESULT", None), 26: ("PTR", None), 27: ("SAFEARRAY", None), 28: ("CARRAY", None), 29: ("USERDEFINED", None), 30: ("LPSTR", PascalString32), 31: ("LPWSTR", PascalString32), 64: ("FILETIME", TimestampWin64), 65: ("BLOB", None), 66: ("STREAM", None), 67: ("STORAGE", None), 68: ("STREAMED_OBJECT", None), 69: ("STORED_OBJECT", None), 70: ("BLOB_OBJECT", None), 71: ("THUMBNAIL", Thumbnail), 72: ("CLSID", None), 0x1000: ("Vector", None), } TYPE_NAME = createDict(TYPE_INFO, 0) def createFields(self): self.osconfig = self.parent.osconfig if True: yield Enum(Bits(self, "type", 12), self.TYPE_NAME) yield Bit(self, "is_vector") yield NullBits(self, "padding", 32-12-1) else: yield Enum(Bits(self, "type", 32), self.TYPE_NAME) tag = self["type"].value kw = {} try: handler = self.TYPE_INFO[tag][1] if handler == PascalString32: osconfig = self.osconfig if tag == self.TYPE_LPSTR: kw["charset"] = osconfig.charset else: kw["charset"] = osconfig.utf16 elif handler == TimestampWin64: if self.description == "TotalEditingTime": handler = TimedeltaWin64 except LookupError: handler = None if not handler: raise ParserError("OLE2: Unable to parse property of type %s" \ % self["type"].display) if self["is_vector"].value: yield UInt32(self, "count") for index in xrange(self["count"].value): yield handler(self, "item[]", **kw) else: yield handler(self, "value", **kw) self.createValue = lambda: self["value"].value PropertyContent.TYPE_INFO[12] = ("VARIANT", PropertyContent) class SummarySection(SeekableFieldSet): CODEPAGE_CHARSET = { 1252: "WINDOWS-1252", 1253: "WINDOWS-1253", 65001: "UTF-8", } def __init__(self, *args): SeekableFieldSet.__init__(self, *args) self._size = self["size"].value * 8 def createFields(self): self.osconfig = self.parent.osconfig yield UInt32(self, "size") yield UInt32(self, "property_count") for index in xrange(self["property_count"].value): yield PropertyIndex(self, "property_index[]") for index in xrange(self["property_count"].value): findex = self["property_index[%u]" % index] self.seekByte(findex["offset"].value) field = PropertyContent(self, "property[]", findex["id"].display) yield field if not self.osconfig.charset \ and findex['id'].value == PropertyIndex.TAG_CODEPAGE: codepage = field['value'].value if codepage in self.CODEPAGE_CHARSET: self.osconfig.charset = self.CODEPAGE_CHARSET.get(codepage) else: self.warning("Unknown codepage: %r" % codepage) class SummaryIndex(FieldSet): static_size = 20*8 def createFields(self): yield String(self, "name", 16) yield UInt32(self, "offset") class BaseSummary: endian = LITTLE_ENDIAN def __init__(self): if self["endian"].value == "\xFF\xFE": self.endian = BIG_ENDIAN elif self["endian"].value == "\xFE\xFF": self.endian = LITTLE_ENDIAN else: raise ParserError("OLE2: Invalid endian value") self.osconfig = OSConfig(self["os_type"].value == OS_MAC) def createFields(self): yield Bytes(self, "endian", 2, "Endian (0xFF 0xFE for Intel)") yield UInt16(self, "format", "Format (0)") yield UInt8(self, "os_version") yield UInt8(self, "os_revision") yield Enum(UInt16(self, "os_type"), OS_NAME) yield GUID(self, "format_id") yield UInt32(self, "section_count") if MAX_SECTION_COUNT < self["section_count"].value: raise ParserError("OLE2: Too much sections (%s)" % self["section_count"].value) section_indexes = [] for index in xrange(self["section_count"].value): section_index = SummaryIndex(self, "section_index[]") yield section_index section_indexes.append(section_index) for section_index in section_indexes: self.seekByte(section_index["offset"].value) yield SummarySection(self, "section[]") size = (self.size - self.current_size) // 8 if 0 < size: yield NullBytes(self, "end_padding", size) class SummaryParser(BaseSummary, HachoirParser, RootSeekableFieldSet): PARSER_TAGS = { "description": "Microsoft Office summary", } def __init__(self, stream, **kw): RootSeekableFieldSet.__init__(self, None, "root", stream, None, stream.askSize(self)) HachoirParser.__init__(self, stream, **kw) BaseSummary.__init__(self) def validate(self): return True class SummaryFieldSet(BaseSummary, FieldSet): def __init__(self, parent, name, description=None, size=None): FieldSet.__init__(self, parent, name, description=description, size=size) BaseSummary.__init__(self) class CompObj(FieldSet): OS_VERSION = { 0x0a03: "Windows 3.1", } def createFields(self): # Header yield UInt16(self, "version", "Version (=1)") yield textHandler(UInt16(self, "endian", "Endian (0xFF 0xFE for Intel)"), hexadecimal) yield UInt8(self, "os_version") yield UInt8(self, "os_revision") yield Enum(UInt16(self, "os_type"), OS_NAME) yield Int32(self, "unused", "(=-1)") yield GUID(self, "clsid") # User type yield PascalString32(self, "user_type", strip="\0") # Clipboard format if self["os_type"].value == OS_MAC: yield Int32(self, "unused[]", "(=-2)") yield String(self, "clipboard_format", 4) else: yield PascalString32(self, "clipboard_format", strip="\0") if self.current_size == self.size: return #-- OLE 2.01 --- # Program ID yield PascalString32(self, "prog_id", strip="\0") if self["os_type"].value != OS_MAC: # Magic number yield textHandler(UInt32(self, "magic", "Magic number (0x71B239F4)"), hexadecimal) # Unicode version yield PascalStringWin32(self, "user_type_unicode", strip="\0") yield PascalStringWin32(self, "clipboard_format_unicode", strip="\0") yield PascalStringWin32(self, "prog_id_unicode", strip="\0") size = (self.size - self.current_size) // 8 if size: yield NullBytes(self, "end_padding", size)
12,628
Python
.py
342
28.023392
94
0.572969
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)
19,699
torrent.py
pwnieexpress_raspberry_pwn/src/pentest/metagoofil/hachoir_parser/misc/torrent.py
""" .torrent metainfo file parser http://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Structure Status: To statufy Author: Christophe Gisquet <christophe.gisquet@free.fr> """ from hachoir_parser import Parser from hachoir_core.field import (FieldSet, ParserError, String, RawBytes) from hachoir_core.endian import LITTLE_ENDIAN from hachoir_core.tools import makePrintable, timestampUNIX, humanFilesize # Maximum number of bytes for string length MAX_STRING_LENGTH = 6 # length in 0..999999 # Maximum number of bytes for integer value MAX_INTEGER_SIZE = 21 # 21 decimal digits (or "-" sign and 20 digits) class Integer(FieldSet): # i<integer encoded in base ten ASCII>e def createFields(self): yield String(self, "start", 1, "Integer start delimiter (i)", charset="ASCII") # Find integer end addr = self.absolute_address+self.current_size len = self.stream.searchBytesLength('e', False, addr, addr+(MAX_INTEGER_SIZE+1)*8) if len is None: raise ParserError("Torrent: Unable to find integer end delimiter (e)!") if not len: raise ParserError("Torrent: error, empty integer!") yield String(self, "value", len, "Integer value", charset="ASCII") yield String(self, "end", 1, "Integer end delimiter") def createValue(self): """Read integer value (may raise ValueError)""" return int(self["value"].value) class TorrentString(FieldSet): # <string length encoded in base ten ASCII>:<string data> def createFields(self): addr = self.absolute_address len = self.stream.searchBytesLength(':', False, addr, addr+(MAX_STRING_LENGTH+1)*8) if len is None: raise ParserError("Torrent: unable to find string separator (':')") if not len: raise ParserError("Torrent: error: no string length!") val = String(self, "length", len, "String length") yield val try: len = int(val.value) except ValueError: len = -1 if len < 0: raise ParserError("Invalid string length (%s)" % makePrintable(val.value, "ASCII", to_unicode=True)) yield String(self, "separator", 1, "String length/value separator") if not len: self.info("Empty string: len=%i" % len) return if len<512: yield String(self, "value", len, "String value", charset="ISO-8859-1") else: # Probably raw data yield RawBytes(self, "value", len, "Raw data") def createValue(self): if "value" in self: field = self["value"] if field.__class__ != RawBytes: return field.value else: return None else: return None class Dictionary(FieldSet): # d<bencoded string><bencoded element>e def createFields(self): yield String(self, "start", 1, "Dictionary start delimiter (d)", charset="ASCII") while self.stream.readBytes(self.absolute_address+self.current_size, 1) != "e": yield DictionaryItem(self, "item[]") yield String(self, "end", 1, "Dictionary end delimiter") class List(FieldSet): # l<bencoded values>e def createFields(self): yield String(self, "start", 1, "List start delimiter") while self.stream.readBytes(self.absolute_address+self.current_size, 1) != "e": yield Entry(self, "item[]") yield String(self, "end", 1, "List end delimiter") class DictionaryItem(FieldSet): def __init__(self, *args): FieldSet.__init__(self, *args) # TODO: Remove this because it's not lazy? key = self["key"] if not key.hasValue(): return key = key.value self._name = str(key).replace(" ", "_") def createDisplay(self): if not self["value"].hasValue(): return None if self._name in ("length", "piece_length"): return humanFilesize(self.value) return FieldSet.createDisplay(self) def createValue(self): if not self["value"].hasValue(): return None if self._name == "creation_date": return self.createTimestampValue() else: return self["value"].value def createFields(self): yield Entry(self, "key") yield Entry(self, "value") def createTimestampValue(self): return timestampUNIX(self["value"].value) # Map first chunk byte => type TAGS = {'d': Dictionary, 'i': Integer, 'l': List} for index in xrange(1, 9+1): TAGS[str(index)] = TorrentString # Create an entry def Entry(parent, name): addr = parent.absolute_address + parent.current_size tag = parent.stream.readBytes(addr, 1) if tag not in TAGS: raise ParserError("Torrent: Entry of type %r not handled" % type) cls = TAGS[tag] return cls(parent, name) class TorrentFile(Parser): endian = LITTLE_ENDIAN MAGIC = "d8:announce" PARSER_TAGS = { "id": "torrent", "category": "misc", "file_ext": ("torrent",), "min_size": 50*8, "mime": (u"application/x-bittorrent",), "magic": ((MAGIC, 0),), "description": "Torrent metainfo file" } def validate(self): if self.stream.readBytes(0, len(self.MAGIC)) != self.MAGIC: return "Invalid magic" return True def createFields(self): yield Dictionary(self, "root", size=self.size)
5,514
Python
.py
137
32.489051
112
0.626799
pwnieexpress/raspberry_pwn
1,024
184
8
GPL-3.0
9/5/2024, 5:12:22 PM (Europe/Amsterdam)