Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 `”bØwã@sbdZddlZddlZddlmZmZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZddlmZdd lmZyddlZdd lmZWnek r¬dZYnXd d „ZdZdZejZd ZdGZ dHZ!dIZ"dJZ#dKZ$dZ%x e&ddƒD]Z'e%d e'>BZ%�qìWej(�rda)dZ*dd„Z+nej,Z+Gdd„dƒZ-Gdd„deƒZ.dZ/dd„Z0dd„Z1e d j2d!d"„e/j3ƒj4ƒDƒƒƒZ5d#d$„Z6dLd%d&„Z7d'd(„Z8e5ddfd)d*„Z9d+d,„Z:dMd-d.„Z;d/d0„ZGd6d7„d7e-eƒZ?dOd8d9„Z@dPd:d;„ZAdQdd?„ZCd@dA„ZDeEdBk�r^dCdD„ejFDƒZGeG�rDdEdD„ejFDƒe_FeHeGƒZdFejFk�rXe=ƒneDƒdS)Rz3.3.0éN)ÚhexlifyÚ unhexlify)ÚBytesIO)Úmd5ÚasBytesÚint2ByteÚrawBytesÚasNative)ÚCanvas)Ú PDFObject)ÚFlowable)Ú rl_config)Úsha256cs"ˆdkr |St‡fdd„|DƒƒS)z9xor's each byte of the key with the number, which is <256rc3s|]}ˆ|AVqdS)N©)Ú.0Úk)Únumrú9/tmp/tmp4i9tl1d3/lib64/python/reportlab/lib/pdfencrypt.pyú szxorKey..)Úbytes)rÚkeyr)rrÚxorKeysrééééééés½�Ü«ovpèì\C�’B~¸ôÞEg8²f€Sj'yÏGÊY¹Ü-ÄQˆ¯Ñ÷¡L>™‰i÷Ä´'ékÉú¦p€Íª¯|—÷Ì ÁïÇ—Ò;¯áü,Ó ¡æËØæ\H} Ü…á¼Ä>|Å—µT­ T•±Ü!¶+E#¡¤Oój˜"ÂËŒHBØB~§7Òè1.ש Ý2 }Àÿmž3â/ê„W‚½ÈKÂ;?¾#„`Wóàìž…œËÇÉ#ÿÞê²Ôš½ºz½‡OÔô¬³(z’ü¼…i�û! |w,‹IÉ_D`A¼}+r-%F(@È\cL2(œ•BM¡‰UG�ýíÎØ±cCs*dd„t|ƒDƒ}t|ƒ}t|da|S)NcSsg|]}t|td‘qS)é)Ú _os_random_bÚ _os_random_x)rÚirrrú 1szos_urandom..r)Úrangerr!)ÚnÚbrrrÚ os_urandom/s r'c@sLeZdZdZddd„Zdd„Zdd „Zd d „Zdd d „Zdd„Z dd„Z dS)ÚStandardEncryptionrNrcCs¸||_|r||_n||_|dkr&tj}|dkr6d|_n<|dkrFd|_n,|dkrbtsZtdƒ‚d|_ntd t|ƒƒ‚||_||_ ||_ ||_ d|_ |_ |_|_|_|_|_dS) a* This class defines the encryption properties to be used while creating a pdf document. Once initiated, a StandardEncryption object can be applied to a Canvas or a BaseDocTemplate. The userPassword parameter sets the user password on the encrypted pdf. The ownerPassword parameter sets the owner password on the encrypted pdf. The boolean flags canPrint, canModify, canCopy, canAnnotate determine wether a user can perform the corresponding actions on the pdf when only a user password has been supplied. If the user supplies the owner password while opening the pdf, all actions can be performed regardless of the flags. Note that the security provided by these encryption settings (and even more so for the flags) is very weak. Né(ré€rrzAstrength==256 is not supported as package pyaes is not importablerzUnknown encryption strength=%s)Ú userPasswordÚ ownerPasswordr ÚencryptionStrengthÚrevisionÚpyaesÚ ValueErrorÚreprÚcanPrintÚ canModifyÚcanCopyÚ canAnnotateÚOÚUÚPrÚOEÚUEÚPerms)Úselfr+r,r2r3r4r5ÚstrengthrrrÚ__init__;s( zStandardEncryption.__init__cCs||_|_|_|_dS)N)r2r3r4r5)r<ÚvaluerrrÚsetAllPermissions]sz$StandardEncryption.setAllPermissionscCsHd}|jr|tB}|jr |tB}|jr.|tB}|jr<|tB}|tB}|S)Nr) r2Ú printabler3Ú modifiabler4Ú copypastabler5Ú annotatableÚ higherbits)r<ÚprrrÚpermissionBitsbsz!StandardEncryption.permissionBitscCs:|jstdƒ‚|jdkr tdƒ‚t|j|j|j||jd�S)zencode a string, stream, textzencryption not prepared!Nznot registered in PDF object)r.)Úpreparedr0ÚobjnumÚ encodePDFrÚversionr.)r<ÚtrrrÚencodejs  zStandardEncryption.encodec CsØtrtd|jƒ|jr tdƒ‚|r*|}n|jƒ}|jjƒ}trDd}trptd|j ƒtd|j ƒtd|ƒt |j ƒd&ƒ|_ trŒd'|_ tr¢td t|j ƒƒ|jd k�r*d(}tdƒ}tdƒ}ttdƒƒ|_t�rtdt|ƒƒtdt|ƒƒtdt|jƒƒtt|j dd…ƒ|ƒ}|jƒ|||_t�rLtdt|jƒƒtt|j dd…ƒ|ƒ}tjtj|jƒ|d�ƒ} | j|jƒ|_|j| jƒ7_t�r¶tdt|jƒƒtdƒ} tdƒ} tt|j dd…ƒ| |jƒ}|jƒ| | |_t�rtdt|jƒƒtt|j dd…ƒ| |jƒ}tjtj|jƒ|d�ƒ} | j|jƒ|_|j| jƒ7_t�r€tdt|jƒƒ|j d@|j d?d@|j d ?d@|j d?d@ddddtdƒtdƒtdƒtdƒddddg} tjtj|j|d�ƒ} | jt| ƒƒ|_|j| jƒ7_t�rÂtd t|jƒƒn˜|jd)k�rÂt |j |j |jƒ|_t�rbtd"t|jƒƒt!|j |j|j ||jd#�|_t�r–tdt|jƒƒt"|j|j|d$�|_t�rÂtd%t|jƒƒd|_#|_$d|_dS)*Nz-StandardEncryption.prepare(...) - revision %dzencryption already prepared!ÚxxxxxxxxxxxxxxxxzuserPassword = %rzownerPassword = %rzinternalID = %rrré,zself.P = %sróééé zuvs (hex) = %szuks (hex) = %szself.key (hex) = %sézself.U (hex) = %s)Úivzself.UE (hex) = %szself.O (hex) = %szself.OE (hex) = %séÿéÚTÚaÚdr&rzself.Perms (hex) = %srzself.O (as hex) = %s)r.)r.Ú documentIdzself.U (as hex) = %sliÔÿÿÿs)rr)%ÚDEBUGÚprintr.rHr0ZIDÚ signatureÚdigestÚ CLOBBERIDr+r,ÚintrGr8ÚCLOBBERPERMISSIONSr1r'rrÚhexTextrr7r/Ú EncrypterÚAESModeOfOperationCBCÚfeedr:r6r9Úordrr;ÚcomputeOÚ encryptionkeyÚcomputeUrIrK) r<ÚdocumentÚ overrideIDZ internalIDZ externalIDrUZuvsZuksZmdÚ encrypterZovsZoksZpermsarrrrrÚprepareqs¦          zStandardEncryption.preparecCs|jstdƒ‚||_||_dS)Nzencryption not prepared!)rHr0rIrK)r<rIrKrrrÚregisteríszStandardEncryption.registerc Cs2|jstdƒ‚t|j|j|j|j|j|j|j d�S)Nzencryption not prepared!)r6r9r7r:r8r;r.) rHr0ÚStandardEncryptionDictionaryr6r9r7r:r8r;r.)r<rrrÚinfoószStandardEncryption.info)NrrrrN)N) Ú__name__Ú __module__Ú __qualname__rHr>r@rGrMrnrorqrrrrr(9s " |r(c@s eZdZdZdd„Zdd„ZdS)rprcCs2||||||f\|_|_|_|_|_|_||_dS)N)r6r9r7r:r8r;r.)r<r6r9r7r:r8r;r.rrrr>ûs(z%StandardEncryptionDictionary.__init__c Cs0ddlm}m}m}|ƒ}|dƒt|jƒt|jƒ|jdœ}|jdkrèd|d<d|d<d|d <t|jƒ|d <t|jƒ|d <t|j ƒ|d <t|j ƒ|d <t|j ƒ|d<|dƒ|d<|dƒ|d<d|dƒ|dƒdœ}d||ƒi}||ƒ|d<n6|jdk�rd|d<d|d<d|d <nd|d<d|d <||ƒ} | j |ƒS)Nr)ÚDummyDocÚ PDFDictionaryÚPDFNameZStandard)ÚFilterr6r7r8rrÚLengthÚRÚVr6r7r9r:r;ZStdCFZStrFZStmFrSZDocOpenZAESV3)ryZ AuthEventZCFMZCFrr*rr) Úreportlab.pdfbase.pdfdocrurvrwrcr6r7r8r.r9r:r;Úformat) r<rkrurvrwÚdummyÚdictZstdcfZcfZpdfdictrrrr}þs<        z#StandardEncryptionDictionary.formatN)rrrsrtZ __RefOnly__r>r}rrrrrpùsrpza 28 BF 4E 5E 4E 75 8A 41 64 00 4E 56 FF FA 01 08 2E 2E 00 B6 D0 68 3E 80 2F 0C A9 FE 64 53 69 7A cCsdttt|ƒƒƒjƒS)z'a legitimate way to show strings in PDFz<%s>)r rrÚupper)Útextrrrrc,srccCs0t|dddƒt|dddƒt|dd…ƒS)Nrúéÿÿÿÿr„)Ú equalityCheckr)rcrrrÚ unHexText0sr†Úccs|]}tt|dƒƒVqdS)rQN)Úchrra)rÚcrrrr5srcCsX|dkrTtj}|dkrd}n8|dkr*d}n*|dkrDts>tdƒ‚d}ntdt|ƒƒ‚|S) Nr)rr*rrzAstrength==256 is not supported as package pyaes is not importablerzUnknown encryption strength=%s)r r-r/r0r1)r.r=rrrÚ checkRevision7srŠc Cst|ƒ}t|ƒt}|dd…}|}d}x0tdƒD]$}|d@}|d?}|t|dƒ7}q2Wtt|ƒƒ} | jt|ƒƒ| jt|ƒƒ| jt|ƒƒ| jƒ} |dkr®| dd…} n2|d kràxtd ƒD]} t| ƒjƒ} qÀW| dd …} t�r t d t d d„|||||| fDƒƒƒ| S)NrSórrVrRrrrré2rQz"encryptionkey(%s,%s,%s,%s,%s)==>%scSsg|]}tt|ƒƒ‘qSr)rcÚstr)rÚxrrrr#dsz!encryptionkey..) rŠrÚ PadStringr$rrÚupdater_r\r]Útuple) ÚpasswordZOwnerKeyZ PermissionsZFileId1r.rFZpermissionsStringr"ZbyteÚhashÚ md5outputrrŽrrrriFs.    &ric CsBddlm}|dks td|ƒ‚|s(|}t|ƒt}|dd…}t|ƒt}|dd…}t|ƒjƒ}tr”tdt tƒt |ƒt |ƒt |ƒt |ƒ|fƒ|dkr´||dd…ƒj |ƒ}nb|dk�rxt d ƒD]} t|ƒjƒ}qÈW|dd …}|}x(t d ƒD]} t | |ƒ} || ƒj |ƒ}qöWt�r>td t d d„||||fDƒƒƒ|S)Nr)ÚArcIVrrzUnknown algorithm revision %srSzEPadString=%s ownerPad=%s password=%s userPad=%s digest=%s revision=%srrŒrQézcomputeO(%s,%s,%s)==>%scSsg|]}tt|ƒƒ‘qSr)rcr�)rrŽrrrr#€szcomputeO..)rr)Úreportlab.lib.arcivr•ÚAssertionErrorrr�rr_r\r]ÚasciirMr$rr‘) r+r,r.r•ZownerPadr’ZuserPadr_r6r"ÚthisKeyrrrrhgs0      ,   "rhc Csæt|ƒ}ddlm}|dkr,||ƒj|ƒ}nŽ|dkrº|dk sDtdƒ‚ttƒ}|jt|ƒƒ|j ƒ}||ƒj|ƒ}x*t ddƒD]}t ||ƒ} || ƒj|ƒ}q|Wxt |ƒdkr´|d 7}qžW|}t râtd td d „|||||fDƒƒƒ|S) Nr)r•rrz+Revision 3 algorithm needs the document ID!rr–rSrPzcomputeU(%s,%s,%s,%s)==>%scSsg|]}tt|ƒƒ‘qSr)rcr�)rrŽrrrr#”szcomputeU..)rŠr—r•rMr˜rr�r�rr_r$rÚlenr\r]r‘) riÚ encodestringr.r[r•ÚresultÚhÚtmpr%ršrrrrjƒs&   $rjcCs6t||ƒ}|tkr2t|ƒttƒkr*tdƒ‚tdƒ‚dS)Nz&lengths don't match! (password failed)z;decode of U doesn't match fixed padstring (password failed))rjr�r›r0)rir7ÚdecodedrrrÚcheckU—s  r¡c Cs’t|ƒ}|dkrº|}|}x(tdƒD]}|t|d@ƒ7}|d?}q"W|}x(tdƒD]}|t|d@ƒ7}|d?}qPWt|ƒjƒ}|dkr’|dd…}n |dkrž|}ddlm} | |ƒj|ƒ} n¨|d k�rbtd ƒ} t j t j || d �ƒ} t |ƒ} d }| d k�rd | d nd | }|dk�r t |ƒ|}t|tƒ�r<||jd ƒ}n |t|ƒ7}| | j|ƒ} | | jƒ7} t�rŽtdtdd„|||||| fDƒƒƒ| S)zEncodes a string or streamrrrVrRNé r)r•rrQ)rUr‡zutf-8zencodePDF(%s,%s,%s,%s,%s)==>%scSsg|]}tt|ƒƒ‘qSr)rcr�)rrŽrrrr#ÊszencodePDF..)rr)rŠr$rrr_r—r•rMr'r/rdrer›rˆÚ isinstancer�rrfr\r]r‘)rZ objectNumberZgenerationNumberÚstringr.Znewkeyr%r"r”r•Z encryptedrUrmZ string_lenÚpaddingZ padding_lenrrrrJŸsD          &rJcCs||kstd|||fƒ‚dS)Nz%s expected=%s observed=%s)r˜)ZobservedÚexpectedÚlabelrrrr…Ísr…cCsÀtdddd�}|jddd�d}d}d }tt|jƒ|d ƒtt|jƒ|d ƒtt|jƒ|d ƒtd ddd�}|jddd�d}d}d}tt|jƒ|dƒtt|jƒ|dƒtt|jƒ|dƒdS)NZUserZOwnerr))r=rN)rlzBzB<09F26CF46190AF8F93B304AD50C16B615DC43C228C9B2D2EA34951A80617B2B1>z z40 bit O valuez40 bit U valuez40 bit key valueZuserpassZ ownerpassr*zB<68E5704AC779A5F0CD89704406587A52F25BF61CADC56A0F8DB6C4DB0052534D>zBz"<13DDE7585D9BE366C976DDD56AF541D1>z128 bit O valuez128 bit U valuez 128 key value)r(rnr…rcr6r7r)ÚencZ expectedOZ expectedUZ expectedKeyrrrÚtestÔs r©r)c Cs"t|||||||d�}||j_dS)z2Applies encryption to the document being generated)r=N)r(Ú_docZencrypt) Zcanvasr+r,r2r3r4r5r=r¨rrrÚ encryptCanvasósr«c@s eZdZdZdd„Zdd„ZdS)ÚEncryptionFlowablez’Drop this in your Platypus story and it will set up the encryption options. If you do it multiple times, the last one before saving will win.cCsdS)Nr)rrr)r<Z availWidthZ availHeightrrrÚwrapszEncryptionFlowable.wrapcCs&t|j|j|j|j|j|j|jƒdS)N)r«Úcanvr+r,r2r3r4r5)r<rrrÚdrawszEncryptionFlowable.drawN)rrrsrtÚ__doc__r­r¯rrrrr¬sr¬cCs tdƒ‚dS)z*For use in Platypus. Call before build().zNot implemented yetN)Ú Exception)Údtr+r,r2r3r4r5r=rrrÚencryptDocTemplatesr³cCsæyddlm}m} Wntk r0tdƒ‚YnX||ddd�\} } t| jƒƒ} | ddd…} tƒ}t|| d �}tr~d |j _ | | |ƒ}x4|D],}|j | |dd…ƒ|j |ƒ|j ƒqŽWt||||||||d �|jƒ|jƒS) aaccepts a PDF file 'as a byte array in memory'; return encrypted one. This is a high level convenience and does not touch the hard disk in any way. If you are encrypting the same file over and over again, it's better to use pageCatcher and cache the results.r)ÚstoreFormsInMemoryÚrestoreFormsInMemoryz~reportlab.lib.pdfencrypt.encryptPdfInMemory failed because rlextra cannot be imported. See https://www.reportlab.com/downloadsr)ÚallZBBoxesZ PageForms0rN)Zpagesizez&[(xxxxxxxxxxxxxxxx)(xxxxxxxxxxxxxxxx)])r=)Zrlextra.pageCatcher.pageCatcherr´rµÚ ImportErrorÚlistÚkeysrr r`rªZ_IDZ setPageSizeZdoFormZshowPager«ÚsaveÚgetvalue)ÚinputPDFr+r,r2r3r4r5r=r´rµZbboxInfoZ pickledFormsÚnamesZ firstPageSizeÚbufr®Z formNamesZformNamerrrÚencryptPdfInMemorys.        r¿c Cs>t|dƒjƒ} t| |||||||d�} t|dƒj| ƒt| ƒS)z>Creates encrypted file OUTPUTFILENAME. Returns size in bytes.Úrb)r=Úwb)ÚopenÚreadr¿Úwriter›) Z inputFileNameZoutputFileNamer+r,r2r3r4r5r=r¼Z outputPDFrrrÚencryptPdfOnDiskDsrÅcCsžtjdd…}d}dddddddd d d d d ddddddddddg}d}d}d}d}d}d}d} |d} t|ƒdd…} t| ƒdk�r’| ddksœ| ddkr¨t|ƒdSt| ƒdkr¼tdƒ‚| d|krö| d} | dd…} tjj| ƒsôtd| ƒ‚ntdƒ‚d } x:dPD]2\}}x&|D]}|| k�r|} | j |ƒ�qW�qWd| k�sRd| k�rÈd| k�rl| j dƒ}d}nd| k�r„| j dƒ}d}yt | |dƒ}Wnd}YnX| j | |dƒ| j |ƒn dd$l m }dd%|d&fdd%|d&fdd'|d(fdd'|d(fdd)|d*fdd)|d*fdd+|d,fd d+|d,fd d-|d.fd d-|d.fd d/|d0fd d/|d0fdd1| d2fdd1| d2ff}dQ}�x|D�]ü}|d| k�rp| j |dƒ}|d|k�rÂ| |ddRk�rÂtd5|dƒ‚y�| |d|k�rP|d|k�rút|dd6tƒƒnt|dd7tƒƒ|�r0td8|d9| |dfƒ| j | |dƒ| j |dƒWnd:|d9‚YnX�qpW|d;k�rêtd<| ƒtd=| ƒtd>| ƒtd?|ƒtd@|ƒtdA|ƒtdB|ƒtdC|ƒtdD|ƒtd>| ƒtdE|ƒ| dk�r2| dSd…dFk�s| dTd…dGk�r&| ddU…}n| }|dH} t| | ||||||| dI� }|�rftdJ| |||fƒt| ƒdk�rštdKt| ƒddV…|fƒ‚nt|ƒdS)WNanPDFENCRYPT USAGE: PdfEncrypt encrypts your PDF files. Line mode usage: % pdfencrypt.exe pdffile [-o ownerpassword] | [owner ownerpassword], [-u userpassword] | [user userpassword], [-p 1|0] | [printable 1|0], [-m 1|0] | [modifiable 1|0], [-c 1|0] | [copypastable 1|0], [-a 1|0] | [annotatable 1|0], [-s savefilename] | [savefile savefilename], [-v 1|0] | [verbose 1|0], [-e128], [encrypt128], [-h] | [help] -o or owner set the owner password. -u or user set the user password. -p or printable set the printable attribute (must be 1 or 0). -m or modifiable sets the modifiable attribute (must be 1 or 0). -c or copypastable sets the copypastable attribute (must be 1 or 0). -a or annotatable sets the annotatable attribute (must be 1 or 0). -s or savefile sets the name for the output PDF file -v or verbose prints useful output to the screen. (this defaults to 'pdffile_encrypted.pdf'). '-e128' or 'encrypt128' allows you to use 128 bit encryption (in beta). '-e256' or 'encrypt256' allows you to use 256 bit encryption (in beta AES). -h or help prints this message. See PdfEncryptIntro.pdf for more information. z-oÚownerz-uÚuserú-prAú-mrBú-crCú-arDz-sZsavefilez-vÚverbosez-hÚhelpú-e128Ú encrypt128ú-e256Z encryptAESr‡rz encrypted.pdfrrz2Must include a filename and one or more arguments!zCan't open input file '%s'!z2First argument must be name of the PDF input file!r)r*rÚ encrypt256)rÌÚOWNERzOwner passwordÚUSERz User passwordÚ PRINTABLEz 'Printable'Ú MODIFIABLEz 'Modifiable'Ú COPYPASTABLEz'Copypastable'Ú ANNOTATABLEz 'Annotatable'ÚSAVEFILEz Output fileÚ1Ú0z#%s value must be either '1' or '0'!z = int(argv[pos+1])z = argv[pos+1]z%s set to: '%s'.rzUnable to set %s.rz infile:z STRENGTH:z SAVEFILE:zUSER:zOWNER:z PRINTABLE:z MODIFIABLE:z COPYPASTABLE:z ANNOTATABLE:zVERBOSE:z.pdfz.PDFz_encrypted.pdf)r=zQwrote output file '%s'(%s bytes) owner password is '%s' user password is '%s'z4 Unrecognised arguments : %s known arguments are: %s©rÎrÏ©r*rÛ©rÐrÑ©rrÝ)rÜrÞ)rÈrArÉrBrCrÊrDrË)rÙrÚéüÿÿÿrßrßr„)ÚsysÚargvr¸r›r]r0ÚosÚpathÚisfileÚremoveÚindexraZreportlab.rl_configrÌÚexecÚvarsrÅr�)Zsys_argvÚusageZ known_modesrÒrÓrÔrÕrÖr×rØÚcallerráÚinfileZSTRENGTHÚsZ_arYÚposÚargrÌÚarglistZbinaryrequiredZthisargZtinfileÚfilesizerrrÚ scriptInterpSsÞ"                                       $ rñcCs tƒdS)N)rñrrrrÚmainþsròÚ__main__cCs g|]}|dd…dkr|‘qS)Néz--debugr)rrŽrrrr#sr#cCs g|]}|dd…dkr|‘qS)Nrôz--debugr)rrŽrrrr#sz--testrrrRrQrS)N)N)Nrrrrr))Nrrrrr))Nrrrrr))Nrrrrr))IÚ __version__ràrâÚbinasciirrÚiorZreportlab.lib.utilsrrrrr Zreportlab.pdfgen.canvasr r|r Zreportlab.platypus.flowablesr Ú reportlabr r/Úhashlibrr·rr`rbÚdebugr\Z reserved1Z reserved2rArBrCrDrEr$r"Z invariantr!r r'Úurandomr(rpr¥rcr†ÚjoinÚstripÚsplitr�rŠrirhrjr¡rJr…r©r«r¬r³r¿rÅrñròrrrárYr›rrrrÚsŒ       A1  ! .    ' ,