<div dir="ltr"><div><br></div><div>Here is the complete background.</div><div><br></div><div>I need to write a tool to run on Linux that will do an LDAP lookup on Active Directory for a specific 'hidden' attribute that tells the client which Active Directory site it belongs to. The tool is part of a larger suite (keytab creation, krb5.conf config etc) already written in Bourne. Unfortunately, the value that is returned from AD is a binary blob. So while I can call ldapsearch to retrieve the value, I still need something to process/decompress the attribute. </div><div><br></div><div>The algorithm to decompress the blob is the same as is outlined in RFC 1035. But Windows implementations of such are sparsely documented.</div><div><br></div><div>I needed to ensure that I understood the decompression algorithm so I wrote some fairly portable code to do both the LDAP lookup and  perform the decompression of the binary blob.</div><div><br></div><div>So while I can port the code from Windows to Linux fairly easily, I would like the tool to be converted to Bourne so that it can be a single script (rather than having to deploy a script and an executable).</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 11:18 AM, Mauro Souza <span dir="ltr"><<a href="mailto:thoriumbr@gmail.com" target="_blank">thoriumbr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>If you have the program in C to process data, going to bash is like swapping a large truck for a turtle. Bash will be orders of magnitude slower, and you will have to take a lot of care to pipe data all over awk, sed, tr and the like.<br></div>Bash is a terrible choice, python (or perl, or PHP) would be faster. Way faster.<br></div><div class="gmail_extra"><br clear="all"><div><div>Mauro<br><a href="http://mauro.limeiratem.com" target="_blank">http://mauro.limeiratem.com</a> - registered Linux User: 294521<br>Scripture is both history, and a love letter from God.</div></div><div><div class="h5">
<br><div class="gmail_quote">2015-08-10 11:42 GMT-03:00 Brent Kimberley <span dir="ltr"><<a href="mailto:Brent.Kimberley@durham.ca" target="_blank">Brent.Kimberley@durham.ca</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How about ihex or srec?<br>
<br>
<br>
  Original Message<br>
From: Giles Orr<br>
Sent: Monday, August 10, 2015 10:32<br>
To: GTALUG Talk<br>
Reply To: GTALUG Talk<br>
Subject: Re: [GTALUG] Processing a binary file with a shell script<br>
<div><div><br>
<br>
On 10 August 2015 at 04:12, Ansar Mohammed <<a href="mailto:ansarm@gmail.com" target="_blank">ansarm@gmail.com</a>> wrote:<br>
> Hello All,<br>
> I am writing a bourne shell script, to read a binary file as input and take<br>
> action depending on the contents of the file.<br>
><br>
> The file is a mixture of ASCII and binary codes (such as ASCII filed lengths<br>
> and flags).<br>
><br>
> I have the processing already done in C. I would like to convert it to a<br>
> bourne shell.<br>
><br>
> Does anyone have any suggestions on what combination of tools I may be able<br>
> to use?<br>
<br>
If you're only trying to look at the ASCII data (and trying to process<br>
binary data in Bash seems like a poor idea), then you may want to look<br>
at the "strings" command:<br>
<br>
$ strings $(which ls)<br>
<br>
"strings" is part of the binutils package on Debian.<br>
<br>
--<br>
Giles<br>
<a href="http://www.gilesorr.com/" target="_blank" rel="noreferrer">http://www.gilesorr.com/</a><br>
<a href="mailto:gilesorr@gmail.com" target="_blank">gilesorr@gmail.com</a><br>
---<br>
Talk Mailing List<br>
<a href="mailto:talk@gtalug.org" target="_blank">talk@gtalug.org</a><br>
<a href="http://gtalug.org/mailman/listinfo/talk" target="_blank" rel="noreferrer">http://gtalug.org/mailman/listinfo/talk</a><br>
</div></div>THIS MESSAGE IS FOR THE USE OF THE INTENDED RECIPIENT(S) ONLY AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, PROPRIETARY, CONFIDENTIAL, AND/OR EXEMPT FROM DISCLOSURE UNDER ANY RELEVANT PRIVACY LEGISLATION. No rights to any privilege have been waived. If you are not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying, conversion to hard copy, taking of action in reliance on or other use of this communication is strictly prohibited. If you are not the intended recipient and have received this message in error, please notify me by return e-mail and delete or destroy all copies of this message.<br>
<div><div>---<br>
Talk Mailing List<br>
<a href="mailto:talk@gtalug.org" target="_blank">talk@gtalug.org</a><br>
<a href="http://gtalug.org/mailman/listinfo/talk" target="_blank" rel="noreferrer">http://gtalug.org/mailman/listinfo/talk</a><br>
</div></div></blockquote></div><br></div></div></div>
<br>---<br>
Talk Mailing List<br>
<a href="mailto:talk@gtalug.org">talk@gtalug.org</a><br>
<a href="http://gtalug.org/mailman/listinfo/talk" target="_blank" rel="noreferrer">http://gtalug.org/mailman/listinfo/talk</a><br>
<br></blockquote></div><br></div>