dradis / dradis-ce

Dradis Framework: Collaboration and reporting for IT Security teams
https://dradis.com/ce/
GNU General Public License v2.0
673 stars 190 forks source link

tables not rendering in HTML #413

Closed jumson closed 4 years ago

jumson commented 5 years ago

Steps to reproduce

I create a table within my evidence, such as:

table{border:1px solid black}. |\3=. IP: 10.11.1.217 | |\3. SMTP Banner: 220 hotline.localdomain ESMTP Postfix | |\3. HELO response: 501 Syntax: HELO hostname | |. IP |. User |_. Response | | 10.11.1.217 | domain admins | 501 5.1.3 Bad recipient address syntax | |\3=. Total time to scan 10.11.1.217: 54 seconds |

and it renders beautifully in the browser:

image

However, when I export to HTML, it completely fails to make a table. It is rendered as: image

And examining the HTML shows no HTML was used to make it into a table: image

Help us help you, how can we reproduce the problem? The steps above should work with every HTML export template found here: https://dradisframework.com/academy/industry/compliance/

Expected behavior

Some kind of table-like structure should appear, similar to how it normally renders.

Actual behavior

see shots above

System configuration

Dradis version: I pulled this from https://github.com/dradis/dradis-ce.git on 23 December 2018.

Ruby version: ruby --version ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux-gnu]

OS version: /etc/os-release PRETTY_NAME="Kali GNU/Linux Rolling" NAME="Kali GNU/Linux" ID=kali VERSION="2019.1" VERSION_ID="2019.1" ID_LIKE=debian ANSI_COLOR="1;31" HOME_URL="https://www.kali.org/" SUPPORT_URL="https://forums.kali.org/" BUG_REPORT_URL="https://bugs.kali.org/"

jumson commented 5 years ago

I just noticed pull request #17, in https://github.com/dradis/dradis-html_export/pull/17 @dormi , I think that would address this issue?

rachkor commented 5 years ago

@jumson you're correct! Keep an eye on that PR for updates and we should have this resolved for you.

jumson commented 5 years ago

Actually, I edited the Gemfile.plugins.template file to get that new html plugin branch -- it seems to work beautifully.

It does not have the pretty formatting, but at least it is a table-like structure: image

The above comes from the same code that generated this in the regular dradis view: image

And both of those come from this code:

table{border:1px solid black}.
|\3=. *_IP: 10.11.1.22_* |
|\3. SMTP Banner: _220 barry ESMTP Sendmail 8.11.6/8.11.6; Sat, 29 Dec 2018 18:47:39 +0200_ |
|\3. HELO response: _501 5.0.0 HELO requires domain address_ |
|_. IP |_. User |_. Response |
| 10.11.1.22 | root | _250 2.1.5 root <root@barry>_ |
| 10.11.1.22 | bin | _250 2.1.5 <bin@barry>_ |
| 10.11.1.22 | daemon | _250 2.1.5 <daemon@barry>_ |
| 10.11.1.22 | games | _250 2.1.5 <games@barry>_ |
| 10.11.1.22 | nobody | _250 2.1.5 <nobody@barry>_ |
|\3=. *Total time to scan 10.11.1.22: 139 seconds * |

If I want to outline each cell or row, it takes more code...I found this source explaining it.

So I can get HTML export output like this: image

using code like this:

table{border:1px solid black}.
|\3={border:1px solid black}. *_IP: 10.11.1.22_* |
|\3{border:1px solid black}.. SMTP Banner: _220 barry ESMTP Sendmail 8.11.6/8.11.6; Sat, 29 Dec 2018 18:47:39 +0200_ |
|\3{border:1px solid black}.. HELO response: _501 5.0.0 HELO requires domain address_ |
|_{border:1px solid black}.. IP |_{border:1px solid black}.. User |_{border:1px solid black}.. Response |
|{border:1px solid black}. 10.11.1.22 |{border:1px solid black}. root |{border:1px solid black}. _250 2.1.5 root <root@barry>_ |
|{border:1px solid black}. 10.11.1.22 |{border:1px solid black}. bin |{border:1px solid black}. _250 2.1.5 <bin@barry>_ |
|{border:1px solid black}. 10.11.1.22 |{border:1px solid black}. daemon |{border:1px solid black}. _250 2.1.5 <daemon@barry>_ |
|{border:1px solid black}. 10.11.1.22 |{border:1px solid black}. games |{border:1px solid black}. _250 2.1.5 <games@barry>_ |
|{border:1px solid black}. 10.11.1.22 |{border:1px solid black}. nobody |{border:1px solid black}. _250 2.1.5 <nobody@barry>_ |
|\3={border:1px solid black}.. *Total time to scan 10.11.1.22: 139 seconds * |
jumson commented 5 years ago

Actually, just found another workaround for all that ugly code: including a CSS class in the HTML template. I edited the default_dradis_template_v3.0.html.erb file and added #tableborders td {border:2px solid black;}, which I got from that source above.

Now, this code:

table(#tableborders){border:2px solid black;font-family: georgia}.
|\3=. *_IP: 10.11.1.22_* |
|\3. SMTP Banner: _220 barry ESMTP Sendmail 8.11.6/8.11.6; Sat, 29 Dec 2018 18:47:39 +0200_ |
|\3. HELO response: _501 5.0.0 HELO requires domain address_ |
|_. IP |_. User |_. Response |
| 10.11.1.22 | root | _250 2.1.5 root <root@barry>_ |
| 10.11.1.22 | bin | _250 2.1.5 <bin@barry>_ |
| 10.11.1.22 | daemon | _250 2.1.5 <daemon@barry>_ |
| 10.11.1.22 | games | _250 2.1.5 <games@barry>_ |
| 10.11.1.22 | nobody | _250 2.1.5 <nobody@barry>_ |
|\3=. *Total time to scan 10.11.1.22: 139 seconds * |

When exported to HTML, appears like this: image

lazyw0lf commented 5 years ago

Hi @jumson , I would like to know what you have modified on the gemfile to get the table rendering working again. Thanks in advance

Actually, I edited the Gemfile.plugins.template file to get that new html plugin branch -- it seems to work beautifully.

dormi commented 5 years ago

@alexsalvetti I think you should modify this line:

gem 'dradis-html_export', '~> 3.11', github: 'dradis/dradis-html_export'

and add branch:

gem 'dradis-html_export', '~> 3.11', github: 'dradis/dradis-html_export', branch: 'render-using-rails'

Then execute bundle.

Remember that the .template files is not really used, it is just a template. The line should be present in Gemfile or Gemfile.plugins.

UPDATE: Also remember that the render-using-rails is WIP, not yet merged/stable.

lazyw0lf commented 5 years ago

Ok thanks @dormi but the string you wrote has a problem with the ` ` instead of ' ' in the branch.

so the command that works for me is this: gem 'dradis-html_export', '~> 3.11', github: 'dradis/dradis-html_export', branch: 'render-using-rails'

MattBudz commented 4 years ago

resolved