Skip to content

Fix HttpCookie integer conversion and cookie jar docs#21025

Open
Hemang360 wants to merge 3 commits intorapid7:masterfrom
Hemang360:cookie-jar-doc-fix
Open

Fix HttpCookie integer conversion and cookie jar docs#21025
Hemang360 wants to merge 3 commits intorapid7:masterfrom
Hemang360:cookie-jar-doc-fix

Conversation

@Hemang360
Copy link

Fix broken Cookie Jar documentation examples (#18573).

  • HttpCookie.new('name', 1) raised TypeError because the constructor passed non string values directly to HTTP::Cookie.new. Now converts to string via to_s.

  • Updated wiki examples to include required domain and path keyword arguments and use string values.

Verification

  • Start msfconsole and run irb
  • Run Msf::Exploit::Remote::HTTP::HttpCookie.new('test', 1). Verify no error, value is "1"
  • Run cj = Msf::Exploit::Remote::HTTP::HttpCookieJar.new
  • Run cj.add(Msf::Exploit::Remote::HTTP::HttpCookie.new('test', 'val', domain: 'example.com', path: '/')). Verify no error
  • Run cj.cookies. Verify cookie is present

Copy link
Contributor

@gardnerapp gardnerapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove type check.

Co-authored-by: gardnerapp <70026825+gardnerapp@users.noreply.github.com>
@Hemang360
Copy link
Author

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants