Ad Widget

Collapse

Web Scenario with Authentication that requires a ViewState

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gvital
    Junior Member
    • Mar 2020
    • 2

    #1

    Web Scenario with Authentication that requires a ViewState

    I am new to Zabbix.
    Trying to create Web Scenario that verifies web login with ViewState. so trying to query VIEWSTATE from a login page with regex (so I can pass it when I am logging in) like this:
    Code:
    regex:id="__VIEWSTATE\" value="(.*)
    Click image for larger version

Name:	Capture.JPG
Views:	353
Size:	69.5 KB
ID:	397689

    This is what I am trying to query:
    Code:
    <input type="hidden" name="__VIEWSTATE" value="5000_character_long_hash">


    Questions:
    Is this the correct way of doing authentications that require VIEWSTATE hash to be passed with the login? or is there some other method?
    Is my regex correct?
    How can I easily verify if Zabbix took my regex correctly?
    How can I see the output of {VIEWSTATE} variable?

  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Based on how often questions like this about web scenarios keep coming up on these forums, I think the Zabbix documentation team would really help by including additional, more complete examples in the documentation.

    To answer what I can of your questions:

    Yes, a web scenario like this is probably the recommended way of doing this in Zabbix.

    Your regex probably isn't correct. I know the example in the docs uses "id=", but that's because "id" is the attribute it's trying to match on the example web page in the docs. In your case, it's name= that should be part of the regex. More importantly, the .* part of it will likely match far more than you want.

    Try using something like:
    Code:
    regex:name="__VIEWSTATE" value="([^"]*)"
    I don't understand what you mean by "verify if Zabbix took my regex correctly?" It let you input it, so Zabbix "took it", even if your regex isn't correct. Zabbix doesn't know what you're trying to do, so it can't know if your regex is "correct".

    If you want to see what got assigned to {VIEWSTATE}, then create a web page of your own (maybe some PHP, you can probably find an example PHP page that just outputs all the variables and values from whatever is POSTed to it) and have Zabbix POST the variable to your own page in the next step in the scenario.

    Comment

    Working...