....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 198.54.126.4  /  Your IP : 216.73.216.159
Web Server : Apache
System : Linux host55.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : aeaw ( 7508)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/libexec/mc/extfs.d/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/libexec/mc/extfs.d/uzip
#! /usr/bin/perl -w
#
# zip file archive Virtual File System for Midnight Commander
# Version 1.4.0 (2001-08-07).
#
# (C) 2000-2001  Oskar Liljeblad <osk@hem.passagen.se>.
#

use POSIX;
use File::Basename;
use strict;

#
# Configuration options
#

# Location of the zip program
my $app_zip = "/usr/bin/zip";
# Location of the unzip program
my $app_unzip = $ENV{MC_TEST_EXTFS_LIST_CMD} || "/usr/bin/unzip";
# Set this to 1 if zipinfo (unzip -Z) is to be used (recommended), otherwise 0.
my $op_has_zipinfo = exists($ENV{MC_TEST_EXTFS_HAVE_ZIPINFO}) ? $ENV{MC_TEST_EXTFS_HAVE_ZIPINFO} : 0;

# Command used to list archives (zipinfo mode)
my $cmd_list_zi = "$app_unzip -Z -l -T";
# Command used to list archives (non-zipinfo mode)
my $cmd_list_nzi = "$app_unzip -qq -v";
# Command used to add a file to the archive
my $cmd_add = "$app_zip -g";
# Command used to add a link file to the archive (unused)
my $cmd_addlink = "$app_zip -g -y";
# Command used to delete a file from the archive
my $cmd_delete = "$app_zip -d";
# Command used to extract a file to standard out
my $cmd_extract = "$app_unzip -p";

# -rw-r--r--  2.2 unx     2891 tx     1435 defN 20000330.211927 ./edit.html
# (perm) (?) (?) (size) (?) (zippedsize) (method) (yyyy)(mm)(dd).(HH)(MM)(SS) (fname)
my $regex_zipinfo_line = qr"^(\S{7,10})\s+(\d+\.\d+)\s+(\S+)\s+(\d+)\s+(\S\S)\s+(\d+)\s+(\S{4})\s+(\d{4})(\d\d)(\d\d)\.(\d\d)(\d\d)(\d\d)\s(.*)$";

#     2891  Defl:N     1435  50%  03-30-00 21:19  50cbaaf8  ./edit.html
# (size) (method) (zippedsize) (zipratio) (mm)-(dd)-(yy|yyyy) (HH):(MM) (cksum) (fname)
#                                       or: (yyyy)-(mm)-(dd)
my $regex_nonzipinfo_line = qr"^\s*(\d+)\s+(\S+)\s+(\d+)\s+(-?\d+\%)\s+(\d+)-(\d?\d)-(\d+)\s+(\d?\d):(\d\d)\s+([0-9a-f]+)\s\s(.*)$";

#
# Main code
#

die "uzip: missing command and/or archive arguments\n" if ($#ARGV < 1);

# Initialization of some global variables
my $cmd = shift;
my %known = ( './' => 1 );
my %pending = ();
my $oldpwd = POSIX::getcwd();
my $archive = shift;
my $aarchive = absolutize($archive, $oldpwd);
my $cmd_list = ($op_has_zipinfo ? $cmd_list_zi : $cmd_list_nzi);
my ($qarchive, $aqarchive) = map (quotemeta, $archive, $aarchive);

# Strip all "." and ".." path components from a pathname.
sub zipfs_canonicalize_pathname($) {
  my ($fname) = @_;
  $fname =~ s,/+,/,g;
  $fname =~ s,(^|/)(?:\.?\./)+,$1,;
  return $fname;
}

# The Midnight Commander never calls this script with archive pathnames
# starting with either "./" or "../". Some ZIP files contain such names,
# so we need to build a translation table for them.
my $zipfs_realpathname_table = undef;
sub zipfs_realpathname($) {
    my ($fname) = @_;

    if (!defined($zipfs_realpathname_table)) {
        $zipfs_realpathname_table = {};
	if (!open(ZIP, "$cmd_list $qarchive |")) {
	    return $fname;
	}
	foreach my $line (<ZIP>) {
	    $line =~ s/\r*\n*$//;
	    if ($op_has_zipinfo) {
		if ($line =~ $regex_zipinfo_line) {
		    my ($fname) = ($14);
		    $zipfs_realpathname_table->{zipfs_canonicalize_pathname($fname)} = $fname;
		}
	    } else {
		if ($line =~ $regex_nonzipinfo_line) {
		    my ($fname) = ($11);
		    $zipfs_realpathname_table->{zipfs_canonicalize_pathname($fname)} = $fname;
		}
	    }
	}
	if (!close(ZIP)) {
	    return $fname;
	}
    }
    if (exists($zipfs_realpathname_table->{$fname})) {
	return $zipfs_realpathname_table->{$fname};
    }
    return $fname;
}

if ($cmd eq 'list')    { &mczipfs_list(@ARGV); }
if ($cmd eq 'rm')      { &mczipfs_rm(@ARGV); }
if ($cmd eq 'rmdir')   { &mczipfs_rmdir(@ARGV); }
if ($cmd eq 'mkdir')   { &mczipfs_mkdir(@ARGV); }
if ($cmd eq 'copyin')  { &mczipfs_copyin(@ARGV); }
if ($cmd eq 'copyout') { &mczipfs_copyout(@ARGV); }
if ($cmd eq 'run')		 { &mczipfs_run(@ARGV); }
#if ($cmd eq 'mklink')  { &mczipfs_mklink(@ARGV); }		# Not supported by MC extfs
#if ($cmd eq 'linkout') { &mczipfs_linkout(@ARGV); }	# Not supported by MC extfs
exit 1;

# Remove a file from the archive.
sub mczipfs_rm {
	my ($qfile) = map { &zipquotemeta(zipfs_realpathname($_)) } @_;

	# "./" at the beginning of pathnames is stripped by Info-ZIP,
	# so convert it to "[.]/" to prevent stripping.
	$qfile =~ s/^\\\./[.]/;

	&checkargs(1, 'archive file', @_);
	&safesystem("$cmd_delete $qarchive $qfile >/dev/null");
	exit;
}

# Remove an empty directory from the archive.
# The only difference from mczipfs_rm is that we append an 
# additional slash to the directory name to remove. I am not
# sure this is absolutely necessary, but it doesn't hurt.
sub mczipfs_rmdir {
	my ($qfile) = map { &zipquotemeta(zipfs_realpathname($_)) } @_;
	&checkargs(1, 'archive directory', @_);
	&safesystem("$cmd_delete $qarchive $qfile/ >/dev/null", 12);
  exit;
}

# Extract a file from the archive.
# Note that we don't need to check if the file is a link,
# because mc apparently doesn't call copyout for symbolic links.
sub mczipfs_copyout {
	my ($qafile, $qfsfile) = map { &zipquotemeta(zipfs_realpathname($_)) } @_;
	&checkargs(1, 'archive file', @_);
	&checkargs(2, 'local file', @_);
	&safesystem("$cmd_extract $qarchive $qafile > $qfsfile", 11);
  exit;
}

# Add a file to the archive.
# This is done by making a temporary directory, in which
# we create a symlink the original file (with a new name).
# Zip is then run to include the real file in the archive,
# with the name of the symbolic link.
# Here we also doesn't need to check for symbolic links,
# because the mc extfs doesn't allow adding of symbolic
# links.
sub mczipfs_copyin {
	my ($afile, $fsfile) = @_;
	&checkargs(1, 'archive file', @_);
	&checkargs(2, 'local file', @_);
	my ($qafile) = quotemeta $afile;
	$fsfile = &absolutize($fsfile, $oldpwd);
	my $adir = File::Basename::dirname($afile);

	my $tmpdir = &mktmpdir();
	chdir $tmpdir || &croak("chdir $tmpdir failed");
	&mkdirs($adir, 0700);
	symlink ($fsfile, $afile) || &croak("link $afile failed");
	&safesystem("$cmd_add $aqarchive $qafile >/dev/null");
	unlink $afile || &croak("unlink $afile failed");
	&rmdirs($adir);
	chdir $oldpwd || &croak("chdir $oldpwd failed");
	rmdir $tmpdir || &croak("rmdir $tmpdir failed");
  exit;
}

# Add an empty directory the the archive.
# This is similar to mczipfs_copyin, except that we don't need
# to use symlinks.
sub mczipfs_mkdir {
	my ($dir) = @_;
	&checkargs(1, 'directory', @_);
	my ($qdir) = quotemeta $dir;

	my $tmpdir = &mktmpdir();
	chdir $tmpdir || &croak("chdir $tmpdir failed");
	&mkdirs($dir, 0700);
	&safesystem("$cmd_add $aqarchive $qdir >/dev/null");
	&rmdirs($dir);
	chdir $oldpwd || &croak("chdir $oldpwd failed");
	rmdir $tmpdir || &croak("rmdir $tmpdir failed");
  exit;
}

# Add a link to the archive. This operation is not used yet,
# because it is not supported by the MC extfs.
sub mczipfs_mklink {
	my ($linkdest, $afile) = @_;
	&checkargs(1, 'link destination', @_);
	&checkargs(2, 'archive file', @_);
	my ($qafile) = quotemeta $afile;
	my $adir = File::Basename::dirname($afile);

	my $tmpdir = &mktmpdir();
	chdir $tmpdir || &croak("chdir $tmpdir failed");
	&mkdirs($adir, 0700);
	symlink ($linkdest, $afile) || &croak("link $afile failed");
	&safesystem("$cmd_addlink $aqarchive $qafile >/dev/null");
	unlink $afile || &croak("unlink $afile failed");
	&rmdirs($adir);
	chdir $oldpwd || &croak("chdir $oldpwd failed");
	rmdir $tmpdir || &croak("rmdir $tmpdir failed");
  exit;
}

# This operation is not used yet, because it is not
# supported by the MC extfs.
sub mczipfs_linkout {
	my ($afile, $fsfile) = @_;
	&checkargs(1, 'archive file', @_);
	&checkargs(2, 'local file', @_);
	my ($qafile) = map { &zipquotemeta($_) } $afile;

	my $linkdest = &get_link_destination($afile);
	symlink ($linkdest, $fsfile) || &croak("link $fsfile failed");
  exit;
}

# Use unzip to find the link destination of a certain file in the
# archive.
sub get_link_destination {
	my ($afile) = @_;
	my ($qafile) = map { &zipquotemeta($_) } $afile;
	my $linkdest = safeticks("$cmd_extract $qarchive $qafile");
	&croak ("extract failed", "link destination of $afile not found")
			if (!defined $linkdest || $linkdest eq '');
	return $linkdest;
}

# List files in the archive.
# Because mc currently doesn't allow a file's parent directory
# to be listed after the file itself, we need to do some
# rearranging of the output. Most of this is done in
# checked_print_file.
sub mczipfs_list {
	open (PIPE, "$cmd_list $qarchive |") || &croak("$app_unzip failed");
	if ($op_has_zipinfo) {
		while (<PIPE>) {
			chomp;
			next if /^Archive:/;
			next if /^\d+ file/;
			next if /^Empty zipfile\.$/;
			my @match = /$regex_zipinfo_line/;
			next if ($#match != 13);
			&checked_print_file(@match);
		}
	} else {
		while (<PIPE>) {
			chomp;
			my @match = /$regex_nonzipinfo_line/;
			next if ($#match != 10);

			# Massage the date.
			my ($year, $month, $day) = $match[4] > 12
			                             ? ($match[4], $match[5], $match[6])   # 4,5,6 = Y,M,D
			                             : ($match[6], $match[4], $match[5]);  # 4,5,6 = M,D,Y
			$year += ($year < 70 ? 2000 : 1900) if $year < 100;  # Fix 2-digit year.

			my @rmatch = ('', '', 'unknown', $match[0], '', $match[2], $match[1],
					$year, $month, $day, $match[7], $match[8], "00", $match[10]);
			&checked_print_file(@rmatch);
		}
	}
	if (!close (PIPE)) {
		&croak("$app_unzip failed") if ($! != 0);
		&croak("$app_unzip failed", 'non-zero exit status ('.($? >> 8).')') 
	}

	foreach my $key (sort keys %pending) {
		foreach my $file (@{ $pending{$key} }) {
			&print_file(@{ $file });
		}
	}

  exit;
}

# Execute a file in the archive, by first extracting it to a
# temporary directory. The name of the extracted file will be
# the same as the name of it in the archive.
sub mczipfs_run {
	my ($afile) = @_;
	&checkargs(1, 'archive file', @_);
	my $qafile = &zipquotemeta(zipfs_realpathname($afile));
	my $tmpdir = &mktmpdir();
	my $tmpfile = File::Basename::basename($afile);

	chdir $tmpdir || &croak("chdir $tmpdir failed");
	&safesystem("$cmd_extract $aqarchive $qafile > $tmpfile");
  chmod 0700, $tmpfile;
	&safesystem("./$tmpfile");
	unlink $tmpfile || &croak("rm $tmpfile failed");
	chdir $oldpwd || &croak("chdir $oldpwd failed");
	rmdir $tmpdir || &croak("rmdir $tmpdir failed");
  exit;
}

# This is called prior to printing the listing of a file.
# A check is done to see if the parent directory of the file has already
# been printed or not. If it hasn't, we must cache it (in %pending) and
# print it later once the parent directory has been listed. When all
# files have been processed, there may still be some that haven't been 
# printed because their parent directories weren't listed at all. These
# files are dealt with in mczipfs_list.
sub checked_print_file {
	my @waiting = ([ @_ ]);

	while ($#waiting != -1) {
		my $item = shift @waiting;
		my $filename = ${$item}[13];
		my $dirname = File::Basename::dirname($filename) . '/';

		if (exists $known{$dirname}) {
			&print_file(@{$item});
			if ($filename =~ /\/$/) {
				$known{$filename} = 1;
				if (exists $pending{$filename}) {
					push @waiting, @{ $pending{$filename} };
					delete $pending{$filename};
				}
			}
		} else {
			push @{$pending{$dirname}}, $item;
		}
	}
}

# Print the mc extfs listing of a file from a set of parsed fields.
# If the file is a link, we extract it from the zip archive and
# include the output as the link destination. Because this output
# is not newline terminated, we must execute unzip once for each
# link file encountered.
sub print_file {
	my ($perms,$zipver,$platform,$realsize,$format,$cmpsize,$comp,$year,$mon,$day,$hours,$mins,$secs,$filename) = @_;
	if ($platform ne 'unx') {
		$perms = ($filename =~ /\/$/ ? 'drwxr-xr-x' : '-rw-r--r--');
	}
	# adjust abnormal perms on directory
	if ($platform eq 'unx' && $filename =~ /\/$/ && $perms =~ /^\?(.*)$/) {
		$perms = 'd'.$1;
	}
	printf "%-10s    1 %-8d %-8d %8s %s/%s/%s %s:%s:%s %s", $perms, $<,
		$(, $realsize, $mon, $day, $year, $hours, $mins, $secs, $filename;
	if ($platform eq 'unx' && $perms =~ /^l/) {
		my $linkdest = &get_link_destination($filename);
		print " -> $linkdest";
	}
	print "\n";
}

# Die with a reasonable error message.
sub croak {
	my ($command, $desc) = @_;
	die "uzip ($cmd): $command - $desc\n" if (defined $desc);
	die "uzip ($cmd): $command - $!\n";
}

# Make a set of directories, like the command `mkdir -p'.
# This subroutine has been tailored for this script, and
# because of that, it ignored the directory name '.'.
sub mkdirs {
	my ($dirs, $mode) = @_;
	$dirs = &cleandirs($dirs);
	return if ($dirs eq '.');

	my $newpos = -1;
	while (($newpos = index($dirs, '/', $newpos+1)) != -1) {
		my $dir = substr($dirs, 0, $newpos);
		mkdir ($dir, $mode) || &croak("mkdir $dir failed");
	}
	mkdir ($dirs, $mode) || &croak("mkdir $dirs failed");
}

# Remove a set of directories, failing if the directories
# contain other files.
# This subroutine has been tailored for this script, and
# because of that, it ignored the directory name '.'.
sub rmdirs {
	my ($dirs) = @_;
	$dirs = &cleandirs($dirs);
	return if ($dirs eq '.');

	rmdir $dirs || &croak("rmdir $dirs failed");
	my $newpos = length($dirs);
	while (($newpos = rindex($dirs, '/', $newpos-1)) != -1) {
		my $dir = substr($dirs, 0, $newpos);
		rmdir $dir || &croak("rmdir $dir failed");
	}
}

# Return a semi-canonical directory name.
sub cleandirs {
	my ($dir) = @_;
	$dir =~ s:/+:/:g;
	$dir =~ s:/*$::;
	return $dir;
}

# Make a temporary directory with mode 0700.
sub mktmpdir {
	use File::Temp qw(mkdtemp);
	my $template = "/tmp/mcuzipfs.XXXXXX";
	$template="$ENV{MC_TMPDIR}/mcuzipfs.XXXXXX" if ($ENV{MC_TMPDIR});
	return mkdtemp($template);
}

# Make a filename absolute and return it.
sub absolutize {
	my ($file, $pwd) = @_;
	return "$pwd/$file" if ($file !~ /^\//);
	return $file;
}

# Like the system built-in function, but with error checking.
# The other argument is an exit status to allow.
sub safesystem {
	my ($command, @allowrc) = @_;
	my ($desc) = ($command =~ /^([^ ]*) */);
	$desc = File::Basename::basename($desc);
	system $command;
	my $rc = $?;
	&croak("`$desc' failed") if (($rc & 0xFF) != 0);
	if ($rc != 0) {
		$rc = $rc >> 8;
		foreach my $arc (@allowrc) {
			return if ($rc == $arc);
		}
		&croak("`$desc' failed", "non-zero exit status ($rc)");
	}
}

# Like backticks built-in, but with error checking.
sub safeticks {
	my ($command, @allowrc) = @_;
	my ($desc) = ($command =~ /^([^ ]*) /);
	$desc = File::Basename::basename($desc);
	my $out = `$command`;
	my $rc = $?;
	&croak("`$desc' failed") if (($rc & 0xFF) != 0);
	if ($rc != 0) {
		$rc = $rc >> 8;
		foreach my $arc (@allowrc) {
			return if ($rc == $arc);
		}
		&croak("`$desc' failed", "non-zero exit status ($rc)");
	}
	return $out;
}

# Make sure enough arguments are supplied, or die.
sub checkargs {
	my $count = shift;
	my $desc = shift;
	&croak('missing argument', $desc) if ($count-1 > $#_);
}

# Quote zip wildcard metacharacters. Unfortunately Info-ZIP zip and unzip
# on unix interpret some wildcards in filenames, despite the fact that
# the shell already does this. Thus this function.
sub zipquotemeta {
	my ($name) = @_;
	my $out = '';
	for (my $c = 0; $c < length $name; $c++) {
		my $ch = substr($name, $c, 1);
		$out .= '\\' if (index('*?[]\\', $ch) != -1);
		$out .= $ch;
	}
	return quotemeta($out);
}

Youez - 2016 - github.com/yon3zu
LinuXploit