Menu

#27 shell script to detect .7z encryption

Unstable (example)
open
nobody
None
5
2017-05-26
2016-10-14
No

see DESCRIPTION inside script

1 Attachments

Discussion

  • Giuseppe Torelli

    Well done! How to run this shell script from within Xarchiver now? I also
    noticed some variables to be defined.

    Giuseppe

     
    • beelzebubbie

      beelzebubbie - 2016-10-15

      /bin/sh detect_7z_encrypt.sh /path/to/detected/7z_binary /path/to/archive

      exit code: 0 if encrypted, 10 (EXIT_CODE_NOT_ENCRYPTED) if not encrypted, else error (errors aren't expected though)

      Note that script expects valid .7z archive file as second argument (I see no reason to detect is it .7z file or not because it is already done in your code. Am I right?)

      There is some «optimisations» done – we are terminating 7z process after successful detection or after listing header is complete (MAX_READ_LINES). Or after READ_TIMEOUT seconds.

      I've checked script running in bash sh mode and busybox sh. Hope it means enough compatibility level.

      Also I've checked the earliest 7z version available for me (9.20), listing header format is same as 16.02, though file-roller code seems to expect another header format in addition. Maybe we should investigate it?

      Right now I haven't implemented forced line-buffering yet, but it will be done soon.

       
      • Giuseppe Torelli

        I thought the detection would be performed inside xarchiver....

        Giuseppe

         
  • beelzebubbie

    beelzebubbie - 2016-10-15

    You're right, the same way as in xa_7zip_extract and sibling functions – construct command string and run command (but in synchronious way). What else may be expected?

     

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

      Yep, you are right. Too many days have passed since I coded it ;) I will
      write a patch as soon as I can. Thank you for your kind support, Ettore. I
      hope to improve Xarchiver always more and more with the help of the
      community!

      Giuseppe

       
      • beelzebubbie

        beelzebubbie - 2016-10-15

        Hope I solve buffering ambiguity soon and update the script accordingly.
        About improving – seems the only way to really improve something is to switch to libarchive. But before we need to design a good abstraction layer above it.

        Btw, who is Ettore? :-)

         
  • Jerry

    Jerry - 2017-05-26
    Post awaiting moderation.

Log in to post a comment.