Skip to main content
Solved

Extension Attribute/Scripting Help (deploying Digital Guardian DLP software)


Forum|alt.badge.img+9

Hey All,

Wondering if anyone out there has: A) installed or worked with Digital Guardian DLP software for Mac?
B) successfully created an extension attribute that reports the agent version installed?
C) mastered the rare art form of text manipulation in the command line and can help me regardless of the software I'm reporting on?

DG's command line binary, "dgctl" has an easy way to report on the currently installed version by typing the following into a Terminal window: "dgagent/dgctl --version" which outputs the following (excessively verbose in my opinion) info:

2017-03-03 16:55:14.968 dgctl[19465:70794] DGAgent for Mac OS X version 7.1.4.0004
2017-03-03 16:55:14.969 dgctl[19465:70794] OK

I've tried piping into tools (and combinations thereof) using sed, grep, awk, cut etc. and no matter what I try, I just get a blank response and no output. I'm looking to cut out everything except the "7.1.4.0004" ideally, but getting frustrated that I can't seem to modify the text at all.

Even by removing any pipes into txt manipulation and just attempting to return the two line result with an echo returns nothing, i.e.

#!/bin/bash

if [ -d /dgagent ] ; then

    dgVersion=$( /dgagent/dgctl --version )

    echo "DG version is $dgVersion"

else

    echo "<result>Not Installed</result>"

fi

exit 0

Before you ask, no, there does not appear to be any plist, log or other static/clear text item installed that I could use instead to report on the version number. Seems like you must get the information by running this command.

Any expert scripting/EA help out there would be very much appreciated! Thank you!

Best answer by iJake

Try this:

dgagent/dgctl --version 2>&1 | head -n1 | awk '{print $10}'
View original
Did this topic help you find an answer to your question?

9 replies

iJake
Forum|alt.badge.img+21
  • Contributor
  • 279 replies
  • March 3, 2017

Seems like you should be able to do:

dgagent/dgctl --version | head -n1 | awk '{print $10}'

Assuming the result is always output that way.


Forum|alt.badge.img+9
  • Author
  • Valued Contributor
  • 61 replies
  • March 6, 2017

Thank you @iJake for the suggestion! Unfortunately no luck and same results... It is almost as if Verdasys (Digital Guardian developer) follows some kind of non-standard output method that is unable to be manipulated and is not clear text. I'll keep trying different stuff and see what the vendor says. Thanks again.


iJake
Forum|alt.badge.img+21
  • Contributor
  • 279 replies
  • Answer
  • March 6, 2017

Try this:

dgagent/dgctl --version 2>&1 | head -n1 | awk '{print $10}'

Forum|alt.badge.img+9
  • Author
  • Valued Contributor
  • 61 replies
  • March 6, 2017

Yes, that did it! Thanks, should have thought of that! Appreciate the help!


iJake
Forum|alt.badge.img+21
  • Contributor
  • 279 replies
  • March 6, 2017

Glad to help!


Forum|alt.badge.img+2
  • New Contributor
  • 16 replies
  • March 14, 2018

If your interested I can share a nice bundle of DG related EAs I have created to assist in its management and deployment. I am in the process of updating and posting my github, so you can either wait or reply this post and I will provide via other means.

-Frank J


Forum|alt.badge.img+5
  • Contributor
  • 16 replies
  • March 14, 2018

@ShadowGT Your DG-related EAs would be appreciated.

-- Mike


Forum|alt.badge.img+2
  • New Contributor
  • 16 replies
  • March 15, 2018

I will be posting more as it scrub and get clearance, but here are the basic ones. I hope it helps:

ShadowGT2000 Repo - DigitalGuardian


easyedc
Forum|alt.badge.img+16
  • Esteemed Contributor
  • 623 replies
  • March 15, 2018

Just saw this, here's the script I have to check the version after working with DG a few years ago.

/dgagent/dgctl --version 2>&1 | grep Mac | awk '{ print $NF}'

which I threw into an EA

#!/bin/sh

DGA=$(/dgagent/dgctl --version 2>&1 | grep Mac | awk '{ print $NF}')

if [[ -z $DGA ]] ; then
  echo "<result>Not Installed</result>"
else
  echo "<result>$DGA</result>"
fi

My only suggestion is using

awk '{ print $NF}'`

over

awk '{print $10}'

In the off chance that that response isn't the 10th string in the future, where as $NF prints the last string. As a side note, I have the unique pleasure distinction luck pain of being the first Mac DG deployment (so they say). It was really bad early going, when they'd just throw code to us untested for us to "work" with.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings