webinject rewrite?

83 views
Skip to first unread message

Skeeve

unread,
Dec 9, 2011, 1:27:17 AM12/9/11
to webi...@googlegroups.com

I stumbled accross webinject last week because we are monitoring our services with Nagios and a colleague, who want's to check a service needs a login/logout.

When I looked at the source code I was a bit shocked ;) and I get the feeling that I need to rewrite the whole stuff.

I already found a newer version in CPAN Webinject but it still has many of the flaws I want to get rid of.

Unfortunately I can't spent too much time on it (I'm not paid for that) :( and I don't yet know anything about the GUI part. So I thought someone here might be interested in helping?

Here are the main drawbacks I found:

  • Despite the statement in the documentation that the testcase files are XML, they are not. For example one can not use "&" for an ampersand, but has to write "&" which will make any XML tool croak.
  • Same is true for "&lt;" which has to be written as \<
  • This "misuse" of XML::Simple, which is sed for parsing, is achieved by rewriting every "&" and every "\<" in the files by "{AMPERSAND}" and "{LESSTHAN}". As a consequence these 2 Strings, should they appear anywhere in the file, will be replaced.
  • The rewrite is done EVERY run and requires a new file in the filesystem.
  • The older version 1.41 (I didn't check the CPAN version) does a second rewrite if the testcase file contains just one case instead of using XML::Simple properly. (ForceArray => 1)

corey goldberg

unread,
Dec 9, 2011, 4:36:35 PM12/9/11
to WebInject
I stumbled across Skeeve's original post (http://www.perlmonks.org/?
node_id=942379)
and replied there.

so.. in my reply, I mentioned that the webinject.org website is
outdated. well, I finally have control over the domain and hosting
again... so I have access to update content (link to new releases,
redesign, more docs, etc).

if anyone is interested in helping, please let me know.

regards,

-Corey

On Dec 9, 1:27 am, Skeeve <stephan.hra...@googlemail.com> wrote:
> I stumbled accross webinject <http://www.perlmonks.org/www.webinject.org>last week because we are monitoring our services with Nagios and a


> colleague, who want's to check a service needs a login/logout.
>
> When I looked at the source code I was a bit shocked ;) and I get the
> feeling that I need to rewrite the whole stuff.
>

> I already found a newer version in CPAN Webinject<http://search.cpan.org/search?mode=module&query=Webinject>but it still has many of the flaws I want to get rid of.


>
> Unfortunately I can't spent too much time on it (I'm not paid for that) :(
> and I don't yet know anything about the GUI part. So I thought someone here
> might be interested in helping?
>
> Here are the main drawbacks I found:
>

>    - Despite the statement in the documentation that the testcase files are


>    XML, they are not. For example one can not use "&amp;" for an ampersand,
>    but has to write "&" which will make any XML tool croak.

>    - Same is true for "&lt;" which has to be written as \<
>    - This "misuse" of XML::Simple, which is sed for parsing, is achieved by


>    rewriting every "&" and every "\<" in the files by "{AMPERSAND}" and
>    "{LESSTHAN}". As a consequence these 2 Strings, should they appear anywhere
>    in the file, will be replaced.

>    - The rewrite is done EVERY run and requires a new file in the
>    filesystem.
>    - The older version 1.41 (I didn't check the CPAN version) does a second

corey goldberg

unread,
Dec 9, 2011, 4:39:50 PM12/9/11
to WebInject
didn't mean to hijack that discussion.
setting the topic back :)

Sven Nierlein

unread,
Dec 10, 2011, 5:44:17 AM12/10/11
to webi...@googlegroups.com
Hi,

Rewriting 10 year old code is rarely a bad idea. For my part, i use webinject only for nagios, so if i would do a rewrite,
i would focus on the nagios plugin only. But, i don't have the time for a full rewrite either and webinject currently
does what i want so there is no reason for me to do a complete rewrite.
Maybe a few glitches could be solved by changing to another XML module, but this probably breaks backwards compatibility.
Which, of course, could be solved with a config option. Or this will be done with a "webinject 2" version.
Having 1-2 tmp files per check is not nice, maybe that could be done with in-memory files.

The source is free and available at https://github.com/sni/Webinject so feel free to send patches and ideas.

If you really want to do a complete rewrite, i doubt it will be compatible with the current configs and testcases. In that
case, Corey has to decide what to do as he is the owner of the "webinject" brand.

Bye,
Sven


On 12/9/11 7:27, Skeeve wrote:
> I stumbled accross webinject <http://www.perlmonks.org/www.webinject.org> last week because we are monitoring our services with Nagios and a colleague, who want's to check a service needs a login/logout.


>
> When I looked at the source code I was a bit shocked ;) and I get the feeling that I need to rewrite the whole stuff.
>

> I already found a newer version in CPAN Webinject <http://search.cpan.org/search?mode=module&query=Webinject> but it still has many of the flaws I want to get rid of.


>
> Unfortunately I can't spent too much time on it (I'm not paid for that) :( and I don't yet know anything about the GUI part. So I thought someone here might be interested in helping?
>
> Here are the main drawbacks I found:
>

> * Despite the statement in the documentation that the testcase files are XML, they are not. For example one can not use "&amp;" for an ampersand, but has to write "&" which will make any XML tool croak.
> * Same is true for "&lt;" which has to be written as \<
> * This "misuse" of XML::Simple, which is sed for parsing, is achieved by rewriting every "&" and every "\<" in the files by "{AMPERSAND}" and "{LESSTHAN}". As a consequence these 2 Strings, should they appear anywhere in the file, will be replaced.
> * The rewrite is done EVERY run and requires a new file in the filesystem.
> * The older version 1.41 (I didn't check the CPAN version) does a second rewrite if the testcase file contains just one case instead of using XML::Simple properly. (ForceArray => 1)
>

Skeeve

unread,
Dec 11, 2011, 6:15:21 AM12/11/11
to WebInject

On Dec 10, 11:44 am, Sven Nierlein <s...@nierlein.de> wrote:
> If you really want to do a complete rewrite, i doubt it will be compatible with the current configs and testcases.

Exactly what I also said in the above-linked original post. But I
intentionally *want* to break compatibility as I really don't like
something which pretends to be XML but isn't. Using XML::Simple isn't
a bad idea in the first place. It's just that it was not used properly
6 years back. Or maybe it was not possible then, I don't know. The
second rewrite of the temp file can be left out if one uses ForceArray
=> 1.

> In that case, Corey has to decide what to do as he is the owner of the "webinject" brand.

Let's see what he will say. Currently I'm also just using the Nagios
plugin of Corey's version. I should at least switch to the CPAN
version as it is not messing up with the installation directory which
is seen as a bad thing where I currently work ,)

Vincent Palluel

unread,
Sep 13, 2013, 6:07:37 AM9/13/13
to webi...@googlegroups.com
Hi,

Same diagnostic here. Good ideas but big lack on standards within the code.
I rforked Webinject yesterday and made some changes (More to come).

It is on github: https://github.com/nofreeze/Webinject

Sven you can have a look and maybe merge my changes in sni/Webinject

Sven Nierlein

unread,
Sep 13, 2013, 6:12:03 AM9/13/13
to webi...@googlegroups.com
On 9/13/13 12:07, Vincent Palluel wrote:
> Hi,
>
> Same diagnostic here. Good ideas but big lack on standards within the code.
> I rforked Webinject yesterday and made some changes (More to come).
>
> It is on github: https://github.com/nofreeze/Webinject
>
> Sven you can have a look and maybe merge my changes in sni/Webinject

Sure, just send me a pull request, then i could have a look.

Sven

Vincent Palluel

unread,
Sep 13, 2013, 6:23:31 AM9/13/13
to webi...@googlegroups.com
Le 13/09/2013 12:12, Sven Nierlein a �crit :
Sent
Reply all
Reply to author
Forward
0 new messages