dradis / dradis-ce

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

Sort Order for IP's of Nodes #127

Closed djsekops closed 2 years ago

djsekops commented 7 years ago

Steps to reproduce

View nodes

Expected behavior

Ideally IP addresses of nodes should be sorted in a logical order

Actual behavior

Sort order logic is counter intuitive, or not sorted...?

System configuration

3.6

Ruby version:

OS version:

rachkor commented 7 years ago

Thanks @Kalaratri! Can you confirm that IP addresses are sorted in ascending order if you treat the entire IP address as a single number? For example, 234.0.0.1 displays in the Node list before 24.0.0.12 because “234001” < “240012". If so, this is something that we're adding to the technical team's list to look into and resolve! Stay tuned here for updates.

djsekops commented 7 years ago

Yes, that's correct! Also for example: 10.11.1.129 10.11.1.14 10.11.1.141

njfox commented 6 years ago

+1. It would be very helpful for us to have Dradis export nodes in ascending order by IP address/alphabetically in Word reports as well. We are currently having to run macros to sort things by IP and it's causing a fair number of headaches.

blase commented 4 years ago

I am running a Dradis fork with default node order (https://github.com/dradis/dradis-ce/blob/master/app/models/node.rb#L18) changed to INET_ATON for MySQL and an initializer to remiplement this function for SQLite using: https://www.rubydoc.info/gems/sqlite3/1.3.13/SQLite3/Database:create_function.

This approach does not require reordering records outside of the model in pure Ruby. The drawback is that only two databases are supported. If that's acceptable I can add some tests and submit a pull request.

dormi commented 4 years ago

The idea is interesting, but I am not sure on the "per database" approach.

Maybe the pure ruby solution is easier to maintain.

For reference, something similar was attempted here: https://github.com/dradis/dradis-ce/pull/431

And this could also help: https://github.com/dradis/dradis-ce/blob/6d4b4988c86fa5414dbe060ea57bbbaba83f9a3d/app/models/issue.rb#L101-L104

https://github.com/dradis/dradis-plugins/blob/master/lib/dradis/plugins/content_service/nodes.rb#L11-L17

MattBudz commented 2 years ago

Closing due to inactivity. This is noted but not on our roadmap to address. Feel free to re-open with new/additional info.