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 !

44 comments:

  1. Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning

    ReplyDelete
  2. 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
  3. Do you require HP printer setup for your mac operating system? Is your printer driver not suitable for macOS? Then visit the 123.hp.com/setup to get the software and driver for better functioning of your printer. You can also call our expert HP support team for services.

    ReplyDelete
  4. Hi this is SaiVijay, I'am from Chennai. I'am a technical writer for a digital marketing company in Chennai for more than five years. And its my own passion to choose this field. I have to write a creative articles, novels, documents. My hobbies are drawing, playing foot ball and playing cricket also. My most favorite one is "Be Tvastra" which one is the most memorable one in my works. I have suggest you to read the articles.
    Digital Marketing Company in Chennai
    Digital Marketing Agency in Chennai
    SEO services in Chennai
    SEO company in Chennai
    Web Design Company in Chennai
    Web Development Company in Chennai
    top 10 digital marketing companies in chennai
    digital marketing companies in chennai
    best digital marketing agency in chennai
    digital marketing companies in anna nagar
    seo services company in chennai
    Best SEO Companies In Chennai
    cheap seo in chennai

    ReplyDelete
  5. 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
  6. Online medical research paper writing services are very difficult to complete and many students are always searching for Medical Assignment Writing Services to help them complete their medical coursework writing services and medical research paper services.

    ReplyDelete
  7. 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
  8. 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
  9. 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
  10. Excellent, This is an amazing superb article Keep Sharing this...
    Thanks a lot!!!!

    Germany VPS Hosting

    ReplyDelete
  11. Nice Information , Thanks For The Great Content

    Get started to Install, Setup, Connect, Print from your 123 hp setup printers. Easy to Download driver & Printer software from HP Envy,HP Officejet,HP Officejet Pro,HP Deskjet Printer Setup Driver Installation

    For More Support

    123.hp.com/Setup

    ReplyDelete
  12. 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
  13. 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
  14. Securium Solutions is a Cyber Security Services company, that offers preventive measures to defend systems from cyber crimes and intelligent threats. We offer advanced solutions that can really bring out effective results, some of the related technologies are penetration testing, network security, endpoint security and many more. We give intelligent solutions by which you can know and get to perform the latest measures to make your devices and information secure from being infected by different kinds of bugs and errors.

    ReplyDelete
  15. Thanks for sharing this informative post. It is nicely interpreted and definitely help bloggers struggling for quality back links. Keep going.Maryland website Design

    ReplyDelete
  16. 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
  17. 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
  18. Writing an assignment or dissertation is not an easy task. It requires detailed knowledge of the topics and writing standards that's why most of the students need help from experts while writing. We at assignment editors pro have a team of qualified experts that provides the best assignment writing services to students and academic professionals. Get free consultancy now with our experts to get professional dissertation help UK to boost your grades.

    ReplyDelete
  19. 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
  20. 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
  21. It is perfect time to make some plans for the future and it is time to be happy. I have read this post and if I could I want to suggest you some interesting things or advice. Maybe you can write next articles referring to thisarticle. I want to read even more things about it! Feel free to visit my website; 카지노

    ReplyDelete
  22. 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
  23. wonderful article. Very interesting to read this article. I would like to thank you for the efforts you had made for writing this Dissertation Writing Services uk. This article resolved my all queries.

    ReplyDelete
  24. 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
  25. Nice knowledge gaining article. This post is really the best on this valuable topic. 야한동영상

    Please visit once. I leave my blog address below
    야설
    야한동영상

    ReplyDelete
  26. I am really happy to say it’s an interesting post to read. I learn new information from your article , you are doing a great job. Keep it up 일본야동

    Please visit once. I leave my blog address below
    한국야동
    일본야동

    ReplyDelete
  27. Excellent information Providing by your Article thank you for taking the time to share with us such a nice article. 한국야동닷컴

    Please visit once. I leave my blog address below
    국산야동
    한국야동닷컴

    ReplyDelete
  28. What an interesting story! I'm glad I finally found what I was looking for. Thanks for this valuable information! 국산야동

    Please visit once. I leave my blog address below
    야설
    국산야동

    ReplyDelete
  29. I am happy to be here and this wonderful blog. I have found here lots of important information for my knowledge I need. Thanks for sharing this amazing post. If you want to Recover Forgot Spectrum Email Password please contact roadrunner support team for solution.

    ReplyDelete
  30. Thank you for sharing this useful article. Keep it up! Regards!
    바카라사이트

    ReplyDelete
  31. This is really helpful post and very informative there is no doubt about it.
    바카라사이트

    ReplyDelete
  32. 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
  33. Thanks For this great content. Really Enjoyed.Keep It up. 온라인경마

    ReplyDelete
  34. Nice information. I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account to get updates instantly. 토토사이트

    ReplyDelete
  35. Mattresszone - Best Mattress in chennai has a wide range of collections which includes not only mattresses but pillows and accessories like bolsters, comfy, comforter, and many more. Visit the nearest store or feel free to visit www.mattresszone.co.in/. We are here for all your sleep needs. Contact through 9150070702.

    ReplyDelete
  36. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future. 토토사이트추천

    ReplyDelete
  37. This is the perfect webpage for everyone who hopes to understand this topic. You know a whole lot its almost tough to argue with you (not that I personally would want to…HaHa). You definitely put a brand new spin on a topic that's been written about for ages. Excellent stuff, just wonderful! Best Digital Marketing Company in Durgapur

    ReplyDelete
  38. Want to buy best duroflex mattress in chennai, Visit us at Duroflex showroom in Chennai or Call us at 9150070702.

    ReplyDelete
  39. Excellent read, I just passed this onto a friend who was doing a little research on that. And he actually bought me lunch as I found it for him smile Therefore let me rephrase that: Thank you for lunch. 먹튀신고

    ReplyDelete
  40. Thanks for sharing this knowledgeable post. What an excellent post and outstanding article. Thanks for your awesome topic. Really I got very valuable information here. To Resolve Roadrunner Email Not Working Online please contact our team for instant help.

    ReplyDelete
  41. 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

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...