Checking Cisco WSA For New Updates Availablity

In this post I will share my PowerShell code for querying the availability of new updates for Cisco WSA (Web Security Virtual Appliance). Unfortunately, Cisco has not created API for this product for querying the status, so I've created script with web requests that basically simulate user's interaction for accessing the web page with updates status info, that looks like this :

The column of interest is "New Update".

I will break the code in several sections for easy reading. So, here is the first part, where I'm ignoring the web certificate provided by the Cisco WSA :

add-type -TypeDefinition  @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
    public bool CheckValidationResult(
        ServicePoint srvPoint, X509Certificate certificate,
        WebRequest request, int certificateProblem) {
        return true;
    }
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

In the next part, I'm collecting the proper credential for checking the updates status, and passing them to the Cisco WSA. In the web request, I'm creating the session variable ses, and collecting the CSRF token and storing it into $csrf variable.

$credential = get-credential -username user -Message "Type Credential"
$Req = Invoke-WebRequest 'https://cisco.wsa.url/login' ` -UseBasicParsing -SessionVariable ses
if (-not $? -or $Req.Content -notmatch '<.+csrf.+value=\"(.+)\"') {
                         return
                       }
$Csrf = $Matches[1]

Creating the body for the request, and sending to the login form of Cisco WSA:

$Body = @username = "$($credential.username)"; ` password = "$($Credential.GetNetworkCredential().password)"; ` action = "Login"CSRFKey = "$Csrf"}
$loginp = Invoke-WebRequest -Uri ("https://cisco.wsa.url/login") `  -Method POST -Body $body -WebSession $ses ` -ContentType "application/x-www-form-urlencoded"

After successful login in, I'm making web request to the URL that contains the update info. The content received, I'm converting it from JSON:

$status = Invoke-WebRequest ` -uri ("https://cisco.wsa.url/security_services/url_filters/anti_malware") ` -websession $ses  

if (-not $? -or $status.Content -notmatch '\"https.*GetAvailabilityStatus.*\"') {
  return
}

$UpdateURL = $Matches[0].Replace('"',"")

$updates = Invoke-WebRequest -uri ($UpdateURL-websession $ses

$updates.Content | ConvertFrom-Json

And the output looks like :

Cisco DVS Object Type Rules                                          : Not Available
Cisco DVS Engine                                                     : Not Available
Cisco DVS Malware User Agent Rules                                   : Not Available
Cisco Web Usage Controls - Application Visibility and Control Data   : Not Available
Cisco URL Categories Database                                        : Not Available
Cisco Web Usage Controls - Web Categorization Categories List        : Not Available
Cisco URL Categories Database Incremental Updates                    : Not Available
McAfee Engine Definition                                             : Not Available
L4 Traffic Monitor Anti-Malware Rules                                : Not Available
Web Reputation Rules                                                 : Not Available
Sophos IDE                                                           : Not Available
Web Reputation IP Filters                                            : Not Available
Webroot Anti-Malware Engine                                          : Not Available
Advanced Malware Protection - Engine Definition                      : Not Available
McAfee DATs                                                          : Not Available
Cisco URL Filtering Engine                                           : Not Available
Cisco Web Usage Controls - Dynamic Content Analysis Engine Data      : Not Available
Cisco Web Usage Controls - Web Categorization Engine                 : Not Available
Cisco Web Usage Controls - Application Visibility and Control Engine : Not Available
Cisco Certificate Blacklist                                          : Not Available
Web Reputation Engine                                                : Not Available
Cisco Internal Certificates - Advanced Malware Protection            : Not Available
Time zone rules                                                      : Not Available
Webroot Malware Categories DATs                                      : Not Available
McAfee Anti-Malware Engine                                           : Not Available
Cisco Trusted Root Certificate Bundle                                : Not Available
Webroot Engine Definition                                            : Not Available
Sophos Engine                                                        : Not Available
Advanced Malware Protection - Cloud Configuration and Settings       : Not Available
Cisco Web Usage Controls - Web Categorization URL Keyword Filters    : Not Available
Cisco Web Usage Controls - Web Categorization Prefix Filters         : Not Available
Web Reputation Prefix Filters                                        : Not Available
Cisco Web Usage Controls - Dynamic Content Analysis Engine           : Not Available


I hope you will find this code useful. It can be used in different scenarios when there are no APIs (like this one for example), and you will like to automate some manual tasks.

Happy codding !

25 comments:

  1. HP Laserjet M479Fdw Setup printer requires a proper driver and software for functioning properly. You have to go along some steps to complete the whole process. To know about the HP Laserjet M479Fdw setup you can contact our HP customer support team. Visit the HP support site for driver and software download.

    ReplyDelete
  2. Look at the way my acquaintance Wesley Virgin's tale begins with this SHOCKING and controversial VIDEO.

    As a matter of fact, Wesley was in the military-and shortly after leaving-he revealed hidden, "mind control" tactics that the government and others used to get whatever they want.

    THESE are the same secrets lots of famous people (especially those who "became famous out of nowhere") and elite business people used to become rich and famous.

    You've heard that you use less than 10% of your brain.

    That's mostly because most of your brainpower is UNCONSCIOUS.

    Maybe that conversation has even taken place INSIDE your own head... as it did in my good friend Wesley Virgin's head 7 years back, while riding a non-registered, garbage bucket of a car with a suspended driver's license and on his banking card.

    "I'm absolutely frustrated with living paycheck to paycheck! When will I finally succeed?"

    You've taken part in those conversations, am I right?

    Your success story is waiting to start. You need to start believing in YOURSELF.

    Learn How To Become A MILLIONAIRE Fast

    ReplyDelete
  3. It is an informative blog post about Cisco WSA. It would help people who are looking for such information. Keep up the good work!

    ReplyDelete
  4. Marvelous I love this!!!!!!!!!! hey all, I want to tell you that this is an awesome blog and which you have written in this blog, each and every word is also great. Nice dear!! Thanks to sharing with us! Thanks a lot, dear!!!!!!!!!
    India VPS Hosing

    ReplyDelete
  5. Thanks for such a great article here. I was searching for something like this for quite a long time and at last I’ve found it on your blog. Visit Germany VPS

    ReplyDelete
  6. Excellent, This is an amazing superb article Keep Sharing this...
    Thanks a lot!!!!

    Germany VPS Hosting

    ReplyDelete
  7. Printer Tech Support | Dell is an American multinational computer technology company that develops, sells, repairs, and supports computers and related products and services. ... network switches, software, computer peripherals, HDTVs, cameras, printers, and electronics.

    ReplyDelete
  8. If you are expecting good quality print results, HP is always the best choice. To begin the printer setup, learn 123.hp.com/setup steps. Never delay contacting our Printer support, if you require any help to begin the printer support and troubleshooting. Dial the customer support number right away for assistance via +1-888-214-1820

    ReplyDelete
  9. Sometimes it becomes really hard for me to differ between truth and lie, and that time I seek the online help from professionals like you and Dissertation Writing Services experts. Thanks for helping me with this post.

    ReplyDelete
  10. Thank you for your sharing. Thanks to this blog I can learn more things. Expand your knowledge and abilities. Actually the article is very practical. Thank you. For instant support related to Forgot AOL Password please contact our team for instant help.

    ReplyDelete
  11. I am actually happy to read this website posts which carries plenty of helpful data, thanks for providing these kinds Feel free to visit my website; 안전놀이터

    ReplyDelete
  12. I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You Feel free to visit my website; 온라인카지노

    ReplyDelete
  13. Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thank you Also visit my site: Feel free to visit my website; 토토

    ReplyDelete
  14. I am very thankful for such a wonderful blog. It's very interesting to read and easy to understand. Thanks for sharing. I will visit your blog daily because I know. It may be very beneficial for me. If you want to Fix Common QuickBooks Error please contact our team for instant help.

    ReplyDelete
  15. This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this.토토사이트



    ReplyDelete
  16. Hello
    My name is Elisabeth and I would like to contribute some articles for your website
    Please let me know if you are accepting Guest or Sponsored Posts with dofollow link inside
    I would like to know all the guidelines to write a perfect article for you

    Best Regards
    Elisabeth Muller
    elismullermarketing@gmail.com

    ReplyDelete
  17. Excellent article with a ton of helpful information. I appreciate you giving that to me. My issue was resolved as well. This post will teach you what books you ought to read. Click here click speed test 10 second to check your click speed. The program is really straightforward and simple to use. We advise utilizing it multiple times.

    ReplyDelete
  18. Looking For Cheap houses for sale in Niagara Falls? Durgesh Patel, Realtor is the right place. We offer a wide range of real estate products like cheap houses in Niagara Falls, cheap to rent homes in Niagara Falls, apartments for sale in Niagara Falls and many more. Contact us with your query or call us at (289) 969-2036.

    ReplyDelete
  19. Are you planning to buy or sell a property in Niagara Falls and looking for a reliable realtor? The first step in finding a reliable Realtor CA Niagara Falls is to do your research.

    ReplyDelete
  20. Congratulations On The Release Of Your Rose Servitova A Season At Sanditon. I love the cover and looking forward to reading this beautiful story.
    Niagara Olympia Homes

    ReplyDelete
  21. Your energy and excitement for your work are contagious. You have a natural ability to inspire others. My profile addresses several critical issues that I believe everyone should be aware of. Please read it for a few moments CPS Tester. The extension is compatible with all Opera browser versions. You do not need to be concerned about compatibility difficulties.

    ReplyDelete
  22. It's impressive how you've come up with a solution using web requests to simulate user interaction and access the web page for updates status information. For Visit: https://iconcpl.com/

    ReplyDelete
  23. Your haven for an unmatched universe of literary delight is scanmangaa! Enter a world where characters come to life, stories transcend time, and adventures happen on every page. You are invited to embark on exciting trips, touching tales, and thought-provoking narratives by our large choice of books, which spans genres.

    ReplyDelete
  24. Thank you for paying meticulous attention to detail and demonstrating how things should be done. Excellent efforts! cyber security companies in Saudi Arabia

    ReplyDelete
  25. Well-written information. Very impressive and to the point
    Have a look at my new blog:WidsMob Montage Crack 2023

    ReplyDelete

How to check EMBG (Unique Master Citizen Number) using regex

In this post, I will share my implementation of how to check if some number looks like EMBG or Unique Master Citizen Number. For those of yo...