Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.advocacy > #471221

Re: What is this BASH Code Doing?

From owl <owl@rooftop.invalid>
Newsgroups comp.os.linux.advocacy
Subject Re: What is this BASH Code Doing?
Date 2018-10-08 21:04 +0000
Organization O.W.L.
Message-ID <az80b8034ga.h9o34@rooftop.invalid> (permalink)
References <6dd66e7f-85b3-45a6-bfbd-0c039ddd6a0d@googlegroups.com>

Show all headers | View raw


fr314159@gmail.com wrote:
> I want to install Foxit Reader on my Linux system but I will NEVER
> allow the commercial installer to run on my machine.
> 
> An answer may be the ArchLinux bash script that is found here:
> 
> https://pastebin.com/kjGhqpxu
> 
> But I am not sure what this bash code is doing:
> 
> _file="FoxitReader.enu.setup.${pkgver}(${_foxitrevision}).x64.run"
> LANG=C grep --only-matching --byte-offset --binary \
>   --text $'7z\xBC\xAF\x27\x1C' "${_file}" | cut -f1 -d: | 
> while read _position
> do
>  dd if="${_file}" \
>  bs=1M iflag=skip_bytes status=none skip=${_position} \
>  of="${pkgname}-installer/bin-${_position}.7z"
> done
> 

The 7z\xBC\xAF\x27\x1C is just the 7z file magic.  It looks like
it's looking it's looking for that magic, and stripping any bytes
that might precede it.  When I create a 7z file, and run the grep 
part of this code, without the cut pipe, it always results in:
0:7z��'
If I put four bytes before the magic, it gives:
4:7z��'

So, dd is just jumping to the start of the 7z magic before it
writes.  

I don't know why why the magic would be in a different
place than the start of the file (maybe for obfuscation?).

Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What is this BASH Code Doing? fr314159@gmail.com - 2018-10-08 11:02 -0700
  Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-08 11:27 -0700
  Re: What is this BASH Code Doing? owl <owl@rooftop.invalid> - 2018-10-08 21:04 +0000
    Re: What is this BASH Code Doing? "F. Russell" <fr@random.info> - 2018-10-08 22:09 +0000
      Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-08 15:52 -0700
        Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-09 08:17 -0700
          Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-09 14:14 -0700
      Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-09 02:04 -0700
        Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-09 11:25 -0700
      Re: What is this BASH Code Doing? "F. Russell" <fr@random.info> - 2018-10-10 09:11 +0000
        Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 02:30 -0700
        Re: What is this BASH Code Doing? Melzzzzz <Melzzzzz@zzzzz.com> - 2018-10-10 18:29 +0000
          Re: What is this BASH Code Doing? fr314159@gmail.com - 2018-10-10 11:42 -0700
            Re: What is this BASH Code Doing? Steve Carroll <fretwizzer@gmail.com> - 2018-10-10 13:32 -0700
              Re: What is this BASH Code Doing? "F. Russell" <fr@random.info> - 2018-10-10 22:59 +0000
                Re: What is this BASH Code Doing? Silicon Vee <siliconvee1945@yahoo.com> - 2018-10-11 01:03 +0200
                Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 16:32 -0700
                Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 16:16 -0700
                Re: What is this BASH Code Doing? DFS <nospam@nospam.com> - 2018-10-10 20:01 -0400
                Re: What is this BASH Code Doing? Silicon Vee <siliconvee1945@yahoo.com> - 2018-10-11 02:02 +0200
                Re: What is this BASH Code Doing? DFS <nospam@nospam.com> - 2018-10-10 20:11 -0400
                Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 17:18 -0700
                Re: What is this BASH Code Doing? "F. Russell" <fr@random.info> - 2018-10-11 00:22 +0000
                Re: What is this BASH Code Doing? Silicon Vee <siliconvee1945@yahoo.com> - 2018-10-11 02:28 +0200
                Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 17:34 -0700
                Re: What is this BASH Code Doing? Steve Carroll <fretwizzer@gmail.com> - 2018-10-10 17:45 -0700
                Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 17:50 -0700
                Re: What is this BASH Code Doing? "F. Russell" <fr@random.info> - 2018-10-11 00:58 +0000
                Re: What is this BASH Code Doing? Steve Carroll <fretwizzer@gmail.com> - 2018-10-10 18:15 -0700
                Re: What is this BASH Code Doing? Silicon Vee <siliconvee1945@yahoo.com> - 2018-10-11 04:28 +0200
          Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 14:59 -0700
    Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-08 17:26 -0700
      Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-09 09:04 -0700
        Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-09 15:33 -0700
          Re: What is this BASH Code Doing? Steve Carroll <frelwizzen@gmail.com> - 2018-10-10 03:32 -0700

csiph-web