Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

juniper config parser tests #12181

Merged
merged 1 commit into from
Aug 20, 2019
Merged

juniper config parser tests #12181

merged 1 commit into from
Aug 20, 2019

Conversation

h00die
Copy link
Contributor

@h00die h00die commented Aug 10, 2019

This PR adds some tests and fixes some bugs found while writing tests for the juniper parser lib.

  • bundle exec rspec spec/lib/msf/core/auxiliary/juniper_spec.rb and make sure it passes.
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 35128
Msf::Auxiliary::Juniper ..................

Top 10 slowest examples (0.99626 seconds, 93.0% of total time):
  Msf::Auxiliary::Juniper#create_credential_and_login creates a Metasploit::Credential::Login
    0.2302 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:69
  Msf::Auxiliary::Juniper#create_credential_and_login associates the Metasploit::Credential::Core with a task if passed
    0.18153 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:72
  Msf::Auxiliary::Juniper#juniper_junos_config_eater deals with root credentials
    0.09443 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:250
  Msf::Auxiliary::Juniper#juniper_junos_config_eater deals with snmp-server community with Read permissions
    0.0812 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:447
  Msf::Auxiliary::Juniper#juniper_junos_config_eater deals with snmp-server community with a space in the community string
    0.08079 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:504
  Msf::Auxiliary::Juniper#juniper_screenos_config_eater deals with snmp-server community with Read-Write permission
    0.0804 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:163
  Msf::Auxiliary::Juniper#juniper_screenos_config_eater deals with admin credentials
    0.07795 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:83
  Msf::Auxiliary::Juniper#juniper_screenos_config_eater deals with snmp-server community with Read permission
    0.07542 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:142
  Msf::Auxiliary::Juniper#juniper_junos_config_eater deals with snmp-server community with Read-Write permissions and view
    0.07169 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:475
  Msf::Auxiliary::Juniper#juniper_junos_config_eater deals with radius
    0.02266 seconds ./spec/lib/msf/core/auxiliary/juniper_spec.rb:535

Finished in 1.07 seconds (files took 4.09 seconds to load)
18 examples, 0 failures

Randomized with seed 35128
Coverage report generated for RSpec to /metasploit-framework/coverage. 773 / 5623 LOC (13.75%) covered.

@h00die h00die added the tests label Aug 10, 2019
@busterb busterb self-assigned this Aug 20, 2019
@busterb
Copy link
Member

busterb commented Aug 20, 2019

Checking it out now.

bcook-r7 pushed a commit that referenced this pull request Aug 20, 2019
@bcook-r7 bcook-r7 merged commit a2160c8 into rapid7:master Aug 20, 2019
msjenkins-r7 pushed a commit that referenced this pull request Aug 20, 2019
@busterb
Copy link
Member

busterb commented Aug 20, 2019

Hmm, once merged to master, Travis started complaining like this:

  18) Msf::Auxiliary::Juniper#juniper_screenos_config_eater deals with snmp-server community with Read-Write permission
2170      Failure/Error: let!(:workspace) { FactoryBot.create(:mdm_workspace) }
2171      
2172      NameError:
2173        uninitialized constant FactoryBot
2174      # ./spec/lib/msf/core/auxiliary/juniper_spec.rb:35:in `block (2 levels) in <top (required)>'

But running locally shows no issues, and this looks identical to cisco_spec.rb. I'm guessing there's an implicit dependency somewhere in the requires, and random test order is shaking it out.

https://travis-ci.org/rapid7/metasploit-framework/jobs/574240275

@busterb
Copy link
Member

busterb commented Aug 20, 2019

There's no explicit require of 'factory_bot' anywhere in framework. I'm guessing we always got by with something else that required it. Will attempt a test PR

bcook-r7 pushed a commit to busterb/metasploit-framework that referenced this pull request Aug 20, 2019
bcook-r7 pushed a commit that referenced this pull request Aug 20, 2019
@busterb busterb added the msf5 label Aug 20, 2019
@busterb
Copy link
Member

busterb commented Aug 20, 2019

Found the issue, looks like the 4.x branch is still on FactoryGirl, which is incompatible with FactoryBot. I just unmerged it from there and we're good to go again.

@h00die h00die deleted the juniper_tests branch August 21, 2019 00:17
@tdoan-r7 tdoan-r7 added the rn-no-release-notes no release notes label Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants