1 Reply Latest reply: Apr 19, 2012 9:39 AM by John Bullough RSS

TNE removing HTML tags

John Bullough

There is a function in the TNE script to remove HTML tags from the emails it sends.  (sub html_to_text) about line 1307.  This doesn't appear to be working.  We use HP Service Manager to to ticketing, and it, according to our admin, can only send out plain text emails.  So basically to alert admins TNE sends the ticket to service manager, it then parses it, crates it own ticket and notifies the admin.  Because of this the sections that are pulled from the Qualys KB have all the html tags exposed.  For exmaple...

 

The vendor released OpenSSL Version 0.9.8 f to addressthis issue. Update to the latest version of OpenSSL.                 

<P>                                                                                                                         

Refer to this <A HREF="http://www.openssl.org/news/secadv_20071012.txt"TARGET="_blank">OpenSSL advisory</A> for more       

information.                                                                                                               

<P>                                                                                                                        

For Redhat advisory, please refer to this <AHREF="http://rhn.redhat.com/errata/RHSA-2007-0813.html"                        

TARGET="_blank">RHSA-2007:0813-2</A>                                                                                       

<P>                                                                                                                        

For Solaris advisory, please refer to <A HREF="http://blogs.sun.com/security/entry/cve_2007_3108"TARGET="_blank">Solaris   

10</A>                                                                                                                     

 

<P>Virtual Patches:<BR>                                                                                                     

<A HREF="http://www.trendmicro.com/vulnerabilitycontrols"TARGET="_blank">Trend Micro VirtualPatching</A><BR>             

Virtual Patch #1000826: OpenSSLSSL_get_shared_ciphers Function Buffer Overflow<BR>                                         

 

So the question is, can anyone verify if the function in the TNE script to remove the HTML tags works?  The complexity of this script is beyond my meger scripting ability, so any guidence on how to get it working would be much appreciated.

 

Thanks!

  • TNE removing HTML tags
    John Bullough

    In case anyone else has this problem, this is how I resolved it.

     

    In... "sub send_im_data_smtp"

     

    I added the line

     

    "$body_temp = $good_html_to_text ($body_temp);"

     

    Then I created a new subroutine...

     

    ##############################

    sub good_html_to_text {

              ### Removes HTML tags from $body_temp

       my ( $html ) = @_;

       $html =~ s/< *A[^>]+HREF *= *\\?["']([^"'\\]+)\\?["'][^>]*>([^<]+)< *\/ *A *>/$2 ( $1 )/gi;

       $html =~ s/<.+?>//gi;

      

       return $html;

    }

    ##########################

     

    Hope this can help anyone with the same problem.

    -John