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

Added support for basic authentication #45

Closed

Conversation

thesp0nge
Copy link

Hi there... sometimes it happens that web agencies publish their wordpress powered website on the Internet using Basic Authentication to protected the blog in the "pre release" moments.

In order to be able to test a wp site even if password protected I add the -b option having the "username:password" parameter.

@erwanlr
Copy link
Member

erwanlr commented Oct 18, 2012

Nice one :)

Just a few things :

  • Bad indentation spotted (browser.rb, lines 157-160) :
if !params.has_key?(:headers)
params = params.merge(:headers => {'Authorization' => @basic_auth})
elsif !params[:headers].has_key?('Authorization')
params[:headers]['Authorization'] = @basic_auth
  • The require 'base64' from wpscan_options.rb line 54 is useless because it's already done in lib/environment.rb line 29
  • Please write the rspec :)

@thesp0nge
Copy link
Author

Fixed the firmer twos...

On 18 October 2012 15:12, erwanlr [email protected] wrote:

Nice one :)

Just a few things :

  • Bad indentation spotted (browser.rb, lines 157-160) :

if !params.has_key?(:headers)params = params.merge(:headers => {'Authorization' => @basic_auth})elsif !params[:headers].has_key?('Authorization')params[:headers]['Authorization'] = @basic_auth

The require 'base64' from wpscan_options.rb line 54 is useless because
it's already done in lib/environment.rb line 29

Please write the rspec :)


Reply to this email directly or view it on GitHubhttps://github.com//pull/45#issuecomment-9563695.

$ cd /pub
$ more beer

The blog that fills the gap between appsec and developers:
http://armoredcode.com

@thesp0nge
Copy link
Author

There is no Rakefile (I'll add later). How do you run the spec suite?

@erwanlr
Copy link
Member

erwanlr commented Oct 18, 2012

Just type "rspec" into the root dir of wpscan :)

You may have to install some gems : rspec, webmock and simplecov

@thesp0nge
Copy link
Author

Actually it was easier than expected. However I was able to write a test for the has_basic_auth? method but I was not able to write the test that says, if the site returns 401, than add a basic_auth to wp_target and then the site whould return 200. :-(

@ethicalhack3r
Copy link
Contributor

@erwanlr do you have any pointers on this? my rspec knowledge is pretty limited too, I need to learn. :)

@thesp0nge
Copy link
Author

Another question guys... is there some background decision on about not creating wpscan as a rubygem? I think packing the scanner in a standard rubish CLI way can be a great deal don't you?

@ethicalhack3r
Copy link
Contributor

Opened an issue. :)

#46

@thesp0nge
Copy link
Author

Great @ethicalhack3r I'll work on it

@erwanlr
Copy link
Member

erwanlr commented Oct 23, 2012

For rpsec, you have only 2 more tests to do :

  • The code into browser.rb in the method merge_request_params
  • The code in wpscan_options.rb for the method basic_auth=

You can check if you cover your code by opening coverage/index.html after running rspec an then clicking on the file where your code is :)

@erwanlr
Copy link
Member

erwanlr commented Oct 23, 2012

Do not forget to modify the readme in order to include the new option :)

@erwanlr
Copy link
Member

erwanlr commented Dec 12, 2012

Basic auth done, just need to update the readme

@erwanlr
Copy link
Member

erwanlr commented Dec 13, 2012

Done (i forgot to reference the commits :x)

@erwanlr erwanlr closed this Dec 13, 2012
@ethicalhack3r
Copy link
Contributor

Awesome! :D

@thesp0nge
Copy link
Author

Sorry for being SO LATE in writing the file your requested. I just became father for the second time and I started working real hard on codesake

@erwanlr
Copy link
Member

erwanlr commented Dec 13, 2012

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants