Importing anti-virus content using cURL and XML-API

Reply
Not applicable

Importing anti-virus content using cURL and XML-API

Hi everyone

I'm writing a script to automate installation of new anti-virus content. The anti-virus content is downloaded from dynamic updates on the palo alto support site.

The problem arises when I try to import the new anti-virus content using the following command:

curl --insecure --form file=@ANTI-VIRUS_CONTENT_FILE "//firewall/api?key=GENERATED_KEY&type=import&category=anti-virus"

The file seems to be uploaded but I can not see it on the firewall and I get the following xml response:

<response status="error" code="17"><msg></msg></response>

I'm running PAN-OS 5.0.4

What am i doing wrong?

Any help would be greatly appreciated

Highlighted
SRA
L4 Transporter

Re: Importing anti-virus content using cURL and XML-API

That's the right query. I just tried it on my PA-200 on PAN-OS 5.0.4-h1 and it works right. Are you trying this to the device via Panorama using the target parameter?

Not applicable

Re: Importing anti-virus content using cURL and XML-API

Thanks for the answer. Yes I was trying to import to the device using the target parameter in panorama. I ran a support case on it an Palo Alto told me that it's not possible to use the target parameter with import. Thankfully i was able to solve my problem without needing to import any files. So in the end it wasn't a problem:)

L0 Member

Re: Importing anti-virus content using cURL and XML-API

Hi,

how did you manage to download the content? My script for importing the update are ok. (using plink) But I am searching for a method to download the updates for the PA site.

Regards,

Ralph

Not applicable

Re: Importing anti-virus content using cURL and XML-API

I used a combination of the perl modules WWW::Mechanize and Mojo::DOM. WWW::Mechanize to log in to the support site and get the page with the link to the content and Mojo::DOM to extract the link using CSS-selectors and then downloaded it using wget. The code is here. It's the downloadContentVersion subroutine that does the job. The code is terribly messy. It was only used for testing. and then i found that it was easier to do it all through panorama and dropped the code. I made my final script available here.

L0 Member

Re: Importing anti-virus content using cURL and XML-API

thanks for your reply and help.

Ralph

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!