Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
MarkWeber
Employee Employee
Employee

Script to display recommended and latest Jumbo Hotfix Accumulators

Script to get an overview of the Recommended and Latest Jumbo Hotfix Accumulators of our Quantum Security Gateways

 

Output:

##############################################################
# Recommended & Latest Jumbo Hotfix Accumulators per version #
##############################################################

######################
### Version R80.40 ###
######################

Recommended:
Take 197

Latest:
Take 198

######################
### Version R81 ###
######################

Recommended:
Take 87

Latest:

######################
### Version R81.10 ###
######################

Recommended:
Take 109

Latest:
Take 110

######################
### Version R81.20 ###
######################

Recommended:
Take 24

Latest:
Take 26

#####################################################

9 Replies
the_rock
Legend
Legend

Ran it in my lab, R81.20, but just keep saying "bad interpreter"

Andy

0 Kudos
MarkWeber
Employee Employee
Employee

Hi, please try it again. I changed the script a little so it runs on a standard Check Point gateway or management server.

If you wan to run this script on a standard linux server you need to change curl_cli to curl in the script.

0 Kudos
the_rock
Legend
Legend

Nope, exact same error.

Andy

0 Kudos
Tal_Paz-Fridman
Employee
Employee

Try dos2unix

(1)
the_rock
Legend
Legend

As much as I would like to blame it being Monday morning, its layer 8 issue on my end lol

Thanks @Tal_Paz-Fridman , that did it 🙌

 

[Expert@quantum-firewall:0]# dos2unix *
dos2unix: converting file Software_version_check.sh to Unix format ...
[Expert@quantum-firewall:0]# ls
Software_version_check.sh
[Expert@quantum-firewall:0]# chmod 777 *
[Expert@quantum-firewall:0]# ./Software_version_check.sh
##############################################################
# Recommended & Latest Jumbo Hotfix Accumulators per version #
##############################################################

######################
### Version R80.40 ###
######################

Recommended:
Take 197

Latest:
Take 198

######################
### Version R81 ###
######################

Recommended:
Take 87

Latest:

######################
### Version R81.10 ###
######################

Recommended:
Take 109

Latest:
Take 110

######################
### Version R81.20 ###
######################

Recommended:
Take 24

Latest:
Take 26

#####################################################
[Expert@quantum-firewall:0]#

0 Kudos
Duane_Toler
Advisor

Likewise, for similar that outputs a JSON.  

This will never run on a Gaia host until R&D updates xmllint to version 20913 (even on R81.20, xmllint is 20904 which doesn't have --xpath).  Regardless, this is good for anything where you're doing automation or some other monitoring.  I tweaked this from someone else's original design (acknowledgement given, too).

 

[det@signet ~]$ cat check_jhf.sh
#!/bin/bash

# Fetch Check Point HFA details
# Original design by Hugo van der Kooij

CURL="curl -s -k -o -"
BASE="https://sc1.checkpoint.com/documents/Jumbo_HFA"


for VER in R80.20 R80.30 R80.40 R81.10 R81.20
do
  if [ $VER = "R81" ]; then
    VER2="R81.00"
  else
    VER2=$VER
  fi

  TAKE_URL="$BASE/$VER/$VER2/"
  #echo " *** Version $VER ***"
  $CURL "${BASE}/${VER}/${VER2}/${VER2}-List-of-all-Resolved-Issues.htm" | \
  xmllint --html --xpath 'concat(//table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[(contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/text()," '"`printf '%s %s' Ongoing ${TAKE_URL}`"'", string(//table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[(contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/@href),"
", //table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[not (contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/text(), " Recommended '`echo $BASE/$VER/$VER2/`'", string(//table[@class="TableStyle-TP_Table_Dark_Header_and_Pattern"]/tbody/tr[not (contains(.//td[3]/p/text(),"-"))][1]/td[1]/p/a/@href),"
")' -  2>/dev/null |\
  sed -e 's/^.*Take //g' -e 's/ - / /g' -e 's/Ongoing Ongoing/ Ongoing/g' -e 's/  Ongoing/ Ongoing/' -e 's/General Availability[ ]*//g' |\
  jq --arg version $VER -R '.|split(" ") as $jhf |
    if ($jhf[0]|length == 0) then
      empty
    else
      { "version" : $version, "take" : $jhf[0], "status" : $jhf[1], "url" : $jhf[2] }
    end'
done |jq -s '{ jhf_list :  .|sort_by(.version,.take)  }'

 

 

0 Kudos
bernhard_m
Collaborator

Reused my script posted above to output json format without requiring xmllint.

#!/bin/bash

if [ -f /etc/profile.d/CP.sh ]; then 
    CURL="curl_cli -s"
else
    CURL="curl -s"
fi

for VER in R80.40 R81 R81.10 R81.20; do
    if [ $VER = "R81" ]; then
            VER2="R81.00"
    else
            VER2=$VER
    fi
    TAKE_URL="http://sc1.checkpoint.com/documents/Jumbo_HFA/$VER/$VER2/"
    
    $CURL "$TAKE_URL/${VER2}_Downloads.htm" |     
        awk '   /<h1>/              { version=substr($1,5) }
                /Take.+Recommended/ { take_r=$2 } 
                /Take.+Latest/      { take_l=$2 }
                END                 { printf( "%s %s %s\n", version, take_r, "Recommended");
                                      printf( "%s %s %s\n", version, take_l?take_l:take_r, "Latest"); }' |
        jq --arg url $TAKE_URL -R '.|split(" ") as $jhf | 
            { "version" : $jhf[0], "take" : $jhf[1], "status" : $jhf[2], "url" : ($url+"Take_"+$jhf[1]+".htm") }'
done | 
  jq -s '{ jhf_list :  .|sort_by(.version,.take)  }'
0 Kudos
the_rock
Legend
Legend

Perfect! 🙌

0 Kudos
the_rock
Legend
Legend

I LOVE that one @bernhard_m 🙌👌👍

Andy

[Expert@CP-management:0]# ./Check_Point_jumbo_script.sh
{
"jhf_list": [
{
"version": "R80.40",
"take": "198",
"status": "Recommended",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R80.40/R80.40/Take_198.htm"
},
{
"version": "R80.40",
"take": "198",
"status": "Latest",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R80.40/R80.40/Take_198.htm"
},
{
"version": "R81",
"take": "87",
"status": "Recommended",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R81/R81.00/Take_87.htm"
},
{
"version": "R81",
"take": "87",
"status": "Latest",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R81/R81.00/Take_87.htm"
},
{
"version": "R81.10",
"take": "110",
"status": "Recommended",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R81.10/R81.10/Take_110.htm"
},
{
"version": "R81.10",
"take": "113",
"status": "Latest",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R81.10/R81.10/Take_113.htm"
},
{
"version": "R81.20",
"take": "26",
"status": "Recommended",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R81.20/R81.20/Take_26.htm"
},
{
"version": "R81.20",
"take": "26",
"status": "Latest",
"url": "http://sc1.checkpoint.com/documents/Jumbo_HFA/R81.20/R81.20/Take_26.htm"
}
]
}
[Expert@CP-management:0]#

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events