Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during checking on updates #2

Open
hattter opened this issue Mar 27, 2018 · 5 comments
Open

Error during checking on updates #2

hattter opened this issue Mar 27, 2018 · 5 comments

Comments

@hattter
Copy link

hattter commented Mar 27, 2018

Hi, i tried your code:

$ python content_downloader.py -v -p antivirus

Checking for new content updates: antivirus
 Not logged in.
 Logging in
 Checking for new content updates (2nd attempt)
Traceback (most recent call last):
  File "content_downloader.py", line 287, in <module>
    main()
  File "content_downloader.py", line 257, in main
    token, updates = content_downloader.check()
  File "content_downloader.py", line 172, in check
    updates = json.loads(match.group(1))
AttributeError: 'NoneType' object has no attribute 'group'

Effect is about the same without -p parameter.

After little investigation I found out, that the last requested page does not contain the pattern with data json:

"data":({"Data":.*?"Total":\d+,"AggregateResults":null})

or anyhing like it. However the response contain this:

<div class="alert alert-error">
        An unexpected error has occurred. Please contact <a href="https://www.paloaltonetworks.com/company/contact-support" target="_blank">support</a>.
    </div>

I belive something is wrong on my end, but I don't know what... The credentials are ok, and it seems it logged in successfuly. I have noticed that You just few days age updated this script so it should work fine. Can You confirm that you can still use this script without problem?

@btorresgil
Copy link
Owner

Hi @hattter, sorry for the slow reply, yes, should still work. Not sure what would cause that 'Unexpected error'. Have you reached out to support? Any luck?

@hattter
Copy link
Author

hattter commented Apr 12, 2018

No, and I don't really know what questions could I ask, as the support site just works, and I can download everything there;)
Ok, I will try to find a fix myself, and will get to You if this is some error, or anything with my OS. Or give up;) Btw, I am using antergos linux, Python 2.7.14, requests (2.18.4), mechanize (0.3.6)
Please note, that the line numbers in my first message were not correct, as I slightly modified the code to see the http responses. But the "mechanic", "work" code was still the same. Right now I cloned into repository again and I get the same error.

@hattter
Copy link
Author

hattter commented Apr 12, 2018

Ok i think i found the cause. This url: https://support.paloaltonetworks.com/Updates/DynamicUpdates/245
contains a number on its end: 245. This is probably Your account number, and mine is different. And I can't browse updates with Your number, and thats why I get errors, or unauthorized. When I changed the number to what I have in my browser it works. Some other member (account) from the same company has the same number.

In responses with errors after logging in I had my email and empty company name, now it is correct.

I think this number should be in the config file, but I don't really know what this is. It may be some variable;) If You confirm that its constant (and can name it), I can submit a fix with this option in config file. Unless You have a better solution...

@btorresgil
Copy link
Owner

I think you’re right about the number causing the problem and needing to be in the config file. The number is your company account number. It used to simply redirect to the default company, but I guess that changed. I have tried without the number hoping it would redirect to your default company, but it doesn’t in my testing.

So I propose 2 changes:

  • move the number to the config file
  • document how to get that number from the url in the browser and write it to the config file

I can work on this if you like, or you can submit a fix. Up to you. Thanks for researching the problem!

@hattter
Copy link
Author

hattter commented Apr 12, 2018

I've made a pull request with my fix, so You can use it. I think we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants