Menu

#90 No prompt for 7z archive password.

v1.0 (example)
open
nobody
None
5
2016-10-13
2015-08-18
No

Hi,

Xarchiver 0.5.4 doesn't prompt for the password of an encrypted 7z archive. It shows an error instead:

7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Enter password (will not be echoed) :
Error: /run/user/1000/gvfs/smb-share:server=nas.local,share=*: Can not open encrypted archive. Wrong password?

Errors: 1

Regards,
Ettore

Related

Bugs: #90

Discussion

  • beelzebubbie

    beelzebubbie - 2016-10-12

    Xarchiver 0.5.4 doesn't understand 7z passwords at all. When file list es encrypted, gui throws 'An error occured', otherwise Xarchiver sometimes hangs, and if not, Password field in 'Extract files' is disabled.

     
    • Giuseppe Torelli

      Hello,

      can you provide a nice patch?

      Thanks
      Giuseppe

      --
      Anti aging stem cell based cosmeceuticals, business for anyone
      https://www.facebook.com/antiagingeurope/

      On 12 October 2016 at 16:56, beelzebubbie beelzebubbie@users.sf.net wrote:

      Xarchiver 0.5.4 doesn't understand 7z passwords at all. When file list es
      encrypted, gui throws 'An error occured', otherwise Xarchiver sometimes
      hangs, and if not, Password field in 'Extract files' is disabled.


      [bugs:#90] No prompt for 7z archive password.

      Status: open
      Group: v1.0 (example)
      Created: Tue Aug 18, 2015 12:08 PM UTC by Ettore Atalan
      Last Updated: Tue Aug 18, 2015 12:08 PM UTC
      Owner: nobody

      Hi,

      Xarchiver 0.5.4 doesn't prompt for the password of an encrypted 7z
      archive. It shows an error instead:

      7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
      p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

      Enter password (will not be echoed) :
      Error: /run/user/1000/gvfs/smb-share:server=nas.local,share=*: Can not
      open encrypted archive. Wrong password?

      Errors: 1

      Regards,
      Ettore


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/xarchiver/bugs/90/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

      Related

      Bugs: #90

  • beelzebubbie

    beelzebubbie - 2016-10-12

    Nice patch? :-) I've read your 2005 year thread about decoding 7z headers and checking if archive is encrypted. There was no shame to leave an idea to reimplement 7z decoder, but of course one can steal relevant code from SDK (http://7-zip.org/sdk.html). Though it'll be a bit of work too (I quickly look into cpp code and found there is no way to quickly create a simple C code from it) :-)

    Maybe we can implement another solution? E.g. we can create simply shell script to detect encryption. If you are ok to add shell script invocation into xa_detect_encrypted_archive(), I can write and maintain it.

     
    • Giuseppe Torelli

      Yep sure, why not? Nice idea! Please do it. Thanks :)

      Giuseppe

      Anti aging stem cell based cosmeceuticals, business for anyone
      https://www.facebook.com/antiagingeurope/

      On 12 October 2016 at 19:59, beelzebubbie beelzebubbie@users.sf.net wrote:

      Nice patch? :-) I've read your 2005 year thread about decoding 7z headers
      and checking if archive is encrypted. There was no shame to leave an idea
      to reimplement 7z decoder, but of course one can steal relevant code from
      SDK (http://7-zip.org/sdk.html). Though it'll be a bit of work too (I
      quickly look into cpp code and found there is no way to quickly create a
      simple C code from it) :-)

      Maybe we can implement another solution? E.g. we can create simply shell
      script to detect encryption. If you are ok to add shell script invocation
      into xa_detect_encrypted_archive(), I can write and maintain it.


      [bugs:#90] No prompt for 7z archive password.

      Status: open
      Group: v1.0 (example)
      Created: Tue Aug 18, 2015 12:08 PM UTC by Ettore Atalan
      Last Updated: Wed Oct 12, 2016 02:56 PM UTC
      Owner: nobody

      Hi,

      Xarchiver 0.5.4 doesn't prompt for the password of an encrypted 7z
      archive. It shows an error instead:

      7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
      p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

      Enter password (will not be echoed) :
      Error: /run/user/1000/gvfs/smb-share:server=nas.local,share=*: Can not
      open encrypted archive. Wrong password?

      Errors: 1

      Regards,
      Ettore


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/xarchiver/bugs/90/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

      Related

      Bugs: #90

  • beelzebubbie

    beelzebubbie - 2016-10-13

    A couple of thoughts about implementing detecting script:

    Detection can be done via something like '7z l -p filename.7z', but everything we really need is a «header», a part of output before file listing (actually, 'Method =' line). So we should terminate 7z process immediately after reading this line (in case the archive contain a lot of files, full listing is a waste of time and resources)

    One problem is there is no easy way to turn off output buffering so we can:
    a) «ignore» buffering, so we can terminate 7z process with long listing only after receiving 4K of output
    b) use something like this: http://expect.sourceforge.net/example/unbuffer.man.html but we should add a dependency for it.
    c) write script in python and use built-in pty libs (new dependency again; but almost all modern linux distros have python installed, so there will not be a really new dependency)

    UPD: seems we can use stdbuf (part of coreutils) instead of unbuffer

    Which way is better, how'd you think?

     

    Last edit: beelzebubbie 2016-10-13
    • Giuseppe Torelli

      I would prefer not to add further dependancies, I developed Xarchiver
      mainly for this reason. So option a would be ok. What of libarchive then?
      If it supports 7z encryption I could change idea... ;)

      Giuseppe

      --
      Anti aging stem cell based cosmeceuticals, business for anyone
      https://www.facebook.com/antiagingeurope/

      On 13 October 2016 at 05:09, beelzebubbie beelzebubbie@users.sf.net wrote:

      A couple of thoughts about implementing detecting script:

      Detection can be done via something like '7z l -p filename.7z', but
      everything we really need is a «header», a part of output before file
      listing (actually, 'Method =' line). So we should terminate 7z process
      immediately after reading this line (in case the archive contain a lot of
      files, full listing is a waste of time and resources)

      One problem is there is no easy way to turn off output buffering so we can:
      a) «ignore» buffering, so we can terminate 7z process with long listing
      only after receiving 4K of output
      b) use something like this: http://expect.sourceforge.net/
      example/unbuffer.man.html but we should add a dependency for it.
      c) write script in python and use built-in pty libs (new dependency again;
      but almost all modern linux distros have python installed, so there will
      not be a really new dependency)

      Which way is better, how'd you think?


      [bugs:#90] No prompt for 7z archive password.

      Status: open
      Group: v1.0 (example)
      Created: Tue Aug 18, 2015 12:08 PM UTC by Ettore Atalan
      Last Updated: Wed Oct 12, 2016 05:59 PM UTC
      Owner: nobody

      Hi,

      Xarchiver 0.5.4 doesn't prompt for the password of an encrypted 7z
      archive. It shows an error instead:

      7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
      p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

      Enter password (will not be echoed) :
      Error: /run/user/1000/gvfs/smb-share:server=nas.local,share=*: Can not
      open encrypted archive. Wrong password?

      Errors: 1

      Regards,
      Ettore


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/xarchiver/bugs/90/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

      Related

      Bugs: #90

  • beelzebubbie

    beelzebubbie - 2016-10-13

    Well, let's check what hides beneath libarchive's «Formats Supported … 7-Zip (read only, starting in libarchive 3.0)». Does it include encryption – is a main question :-)

     
    • Giuseppe Torelli

      Ok, I would say then go with option a) then!

      --
      Anti aging stem cell based cosmeceuticals, business for anyone
      https://www.facebook.com/antiagingeurope/

      On 13 October 2016 at 11:27, beelzebubbie beelzebubbie@users.sf.net wrote:

      Well, let's check what hides beneath libarchive's «Formats Supported …
      7-Zip (read only, starting in libarchive 3.0)». Does it include encryption
      – is a main question :-)


      [bugs:#90] No prompt for 7z archive password.

      Status: open
      Group: v1.0 (example)
      Created: Tue Aug 18, 2015 12:08 PM UTC by Ettore Atalan
      Last Updated: Thu Oct 13, 2016 03:09 AM UTC
      Owner: nobody

      Hi,

      Xarchiver 0.5.4 doesn't prompt for the password of an encrypted 7z
      archive. It shows an error instead:

      7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
      p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

      Enter password (will not be echoed) :
      Error: /run/user/1000/gvfs/smb-share:server=nas.local,share=*: Can not
      open encrypted archive. Wrong password?

      Errors: 1

      Regards,
      Ettore


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/xarchiver/bugs/90/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

      Related

      Bugs: #90

  • beelzebubbie

    beelzebubbie - 2016-10-13

    Giuseppe, can I ask you to not quote all the stuff in every message? It makes thread hardly readable :-)

    about a) option – do you think the coreutils dependency is a bad idea? Do we plan to install xarchiver to routers and embedded systems? :-) I hardly believe that someone uses gtk but not uses coreutils

    before going further, I plan to investigate libarchive API and more, I think it worth to look into file-roller code to check how it detects 7z encryption.

     
    • Giuseppe Torelli

      Apologies, Ettore, I didn't realize that! Good idea to look at file roller
      code! I agree!

      Giuseppe

       
      • beelzebubbie

        beelzebubbie - 2016-10-13

        seems noone want to get into Pavlov's code :-D
        fileroller's code (fr-command-7z.c) relays on parsing listing output too:

        else if (strcmp (fields[0], "Encrypted") == 0) {
            if (strcmp (fields[1], "+") == 0)
                fdata->encrypted = TRUE;
        }
        else if (strcmp (fields[0], "Method") == 0) {
            if (strstr (fields[1], "AES") != NULL)
                fdata->encrypted = TRUE;
        

        As for me, such an approach (rigid, fragile and built-in parsing of third-party process output) should never exist at all. At least we should use regular expressions.

        I'll check libarchive later, and if it fails, I'll start to write a script

         
  • beelzebubbie

    beelzebubbie - 2016-10-13

    Good news, everyone! :-) Giuseppe, your guess about libarchive was brilliant!
    At least, we easily can detect 7z encryption, but not only for 7z. More, I guess we can use libarchive' archive type/needed_properties detection too.

    For instance, we can read headers until we find encrypted one:
    ( https://github.com/libarchive/libarchive/wiki/Examples )

    struct archive *a;
    struct archive_entry *entry;
    int r;
    
    a = archive_read_new();
    archive_read_support_filter_all(a);
    archive_read_support_format_all(a);
    r = archive_read_open_filename(a, "archive.tar", 10240); // Note 1
    if (r != ARCHIVE_OK)
      exit(1);
    while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
    
      // do detection, something like
      // if (archive_entry_is_encrypted(&entry) || archive_entry_is_data encrypted(&entry) || int archive_entry_is_metadata_encrypted(&entry)) { encrypted = 1; break; }
      printf("%s\\n",archive_entry_pathname(entry));
      archive_read_data_skip(a);  // Note 2
    }
    r = archive_read_free(a);
    

    archive_entry.h defines encryption-related entry functions:

    __LA_DECL int archive_entry_is_data_encrypted(struct archive_entry *);
    __LA_DECL int archive_entry_is_metadata_encrypted(struct archive_entry *);
    __LA_DECL int archive_entry_is_encrypted(struct archive_entry *);
    

    obviously, now we have enough API to detect anything we need about any archive.
    sorry, right now I can't write proper C code because last time I wrote something in C was long, long time ago...

     
    • Giuseppe Torelli

      That's a good news indeed! I think the whole code must be rewritten now as
      it would be no sense to add libarchive as a dependancy only to check
      encrypted archives. I also would take the opportunity to use GTK+3 rather
      than the obsolete 2.

      Any good developer can help?

      --
      Anti aging stem cell based cosmeceuticals, business for anyone
      https://www.facebook.com/antiagingeurope/

      On 13 October 2016 at 17:12, beelzebubbie beelzebubbie@users.sf.net wrote:

      Good news, everyone! :-) Giuseppe, your guess about libarchive was
      brilliant!
      At least, we easily can detect 7z encryption, but not only for 7z. More, I
      guess we can use libarchive' archive type/needed_properties detection too.

      For instance, we can read headers until we find encrypted one:
      ( https://github.com/libarchive/libarchive/wiki/Examples )

      ~~~
      struct archive a;
      struct archive_entry
      entry;
      int r;

      a = archive_read_new();
      archive_read_support_filter_all(a);
      archive_read_support_format_all(a);
      r = archive_read_open_filename(a, "archive.tar", 10240); // Note 1
      if (r != ARCHIVE_OK)
      exit(1);
      while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {

      // do detection, something like
      // if (archive_entry_is_encrypted(&entry) || archive_entry_is_data
      encrypted(&entry) || int archive_entry_is_metadata_encrypted(&entry)) {
      encrypted = 1; break; }
      printf("%s\n",archive_entry_pathname(entry));
      archive_read_data_skip(a); // Note 2
      }
      r = archive_read_free(a);
      ~~~

      archive_entry.h defines encryption-related entry functions:

      ~~~
      LA_DECL int archive_entry_is_data_encrypted(struct archive_entry *);
      LA_DECL int archive_entry_is_metadata_encrypted(struct archive_entry );
      __LA_DECL int archive_entry_is_encrypted(struct archive_entry
      );
      ~~~

      obviously, now we have enough API to detect anything we need about any
      archive.
      sorry, right now I can't write proper C code because last time I wrote
      something in C was long, long time ago...


      [bugs:#90] No prompt for 7z archive password.

      Status: open
      Group: v1.0 (example)
      Created: Tue Aug 18, 2015 12:08 PM UTC by Ettore Atalan
      Last Updated: Thu Oct 13, 2016 09:42 AM UTC
      Owner: nobody

      Hi,

      Xarchiver 0.5.4 doesn't prompt for the password of an encrypted 7z
      archive. It shows an error instead:

      7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
      p7zip Version 9.20 (locale=de_DE.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

      Enter password (will not be echoed) :
      Error: /run/user/1000/gvfs/smb-share:server=nas.local,share=*: Can not
      open encrypted archive. Wrong password?

      Errors: 1

      Regards,
      Ettore


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/xarchiver/bugs/90/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       

      Related

      Bugs: #90

  • beelzebubbie

    beelzebubbie - 2016-10-13

    It's not so hard to use functions from well-written code (seems libarchive is good enough) but it's far more hard to understand current code and properly refactor it....

    Just an idea – maybe we can migrate to python? There is a good adapter to libarchive – https://github.com/dsoprea/PyEasyArchive so I can implement non-gui code parts. Hope we can even avoid running command-line archive utilities and process archives in a more straight and clear way

     
    • Giuseppe Torelli

      No, thanks.

       
      • beelzebubbie

        beelzebubbie - 2016-10-13

        Well, let's implement shell script detection then. Ok?

         
        • Giuseppe Torelli

          Yeeeeees!

          Giuseppe

           
          • beelzebubbie

            beelzebubbie - 2016-10-14

            Please check a patch#27

             

Log in to post a comment.