check_http find string in iframe

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

check_http find string in iframe

Post by iam33 »

Hi!
Thanks in advance!

I would like to search for a string in an iframe from url with check_http but I can do it. I usually use this to find a string in "normal" http content:

Code: Select all

check_http -H host -u <URI> -f follow -s <string>
but if the page returns the content in an iframe, the plugin can't find it.

Could someone tell me how to do it?

Thanks!
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

Re: check_http find string in iframe

Post by iam33 »

Any ideas?

thanks!!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_http find string in iframe

Post by mcapra »

Is there something preventing you from running check_http against the iframe's source directly? Rather than the page that attempts to render it in-line?

I don't think check_http (or cURL for that matter) can be made to render iframes.

Here's a test.html page I loaded up onto a test site of mine:

Code: Select all

<html lang="en-US" style="height: 100%;"><head>
<title>HTML Iframes</title>
</head>
foo
<iframe src="bar.html" title="Test" height="350px" width="99%"></iframe>
</html>
And here's the content of the iframe I'm embedding:

Code: Select all

bar
check_http just doesn't render the iframe's content

Code: Select all

# ./check_http -H test.site.com -u /test.html  -v
GET /test.html HTTP/1.1
User-Agent: check_http/v2.2.1.git (nagios-plugins 2.2.1)
Connection: close
Host: test.site.com
Accept: */*


http://test.site.com:80/test.html is 967 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Mon, 18 Jan 2021 16:26:06 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: close
Set-Cookie: __cfduid=dee47350a62a0800f3bcb8d3199e6d6901610987166; expires=Wed, 17-Feb-21 16:26:06 GMT; path=/; domain=.site.com; HttpOnly; SameSite=Lax
Last-Modified: Mon, 18 Jan 2021 16:24:57 GMT
Accept-Ranges: bytes
CF-Cache-Status: DYNAMIC
cf-request-id: 07b7ea721100007f9c2d8fc000000001
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=KfuUajFhsyp%2FGXKYMwirG3Vhcnwb14qwCo5qO3UTaMOo6X%2FxOGnToyzGIPoyW5kd3ejfZHOyVvpwHVPbrHwsmVNFWGfuJZz42maV5EUmFoGCuMTn"}],"group":"cf-nel","max_age":604800}
NEL: {"max_age":604800,"report_to":"cf-nel"}
Server: cloudflare
CF-RAY: 6139acfce8fe7f9c-ORD
**** CONTENT ****

<html lang="en-US" style="height: 100%;"><head>
<title>HTML Iframes</title>
</head>
foo
<iframe src="bar.html" title="Test" height="350px" width="99%"></iframe>
</html>

HTTP OK: HTTP/1.1 200 OK - 967 bytes in 0.053 second response time |time=0.053096s;;;0.000000 size=967B;;;0
You would need to leverage something like webinject, or a webdriver with something like Selenium, to get iframes to render.
Former Nagios employee
https://www.mcapra.com/
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

Re: check_http find string in iframe

Post by iam33 »

thank you so much for your answer, I supposed....
Locked