Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript tracing of cookie source

I have a server with tons of lines of Javascript and i need to check lines, which sets a new cookie.

All JS files are minified (variable names are abbreviated to one char etc.), so search it by the name of the cookie is almost impossible.

Is there any software/debugger/browser/approach/whatever which is able to track the lines of code, which sets up some cookies?

I've tried to use a Chrome built-in webkit debugger which allows me to set up an "Event Listener Breakpoints". Unfortunately it cannot listen to setting new cookie.

like image 646
Radek Simko Avatar asked Jun 06 '11 14:06

Radek Simko


People also ask

How do I find out where cookies come from?

For Google Chrome go to View > Developer > Developer Tools or CMD + ALT + I on Mac or F12 on Windows. ‍Now open the Application tab and check the cookies for each domain. Usually the cookies have names that resemble the name of the service they are being used by.

Can JavaScript access cookie?

JavaScript can also manipulate cookies using the cookie property of the Document object. JavaScript can read, create, modify, and delete the cookies that apply to the current web page.

What are cookies and tracking scripts?

Cookies, tracking scripts, and pixels are different tools used to get a better understanding of the users on your website. They are used to help identify, collect, and transfer data from a given site to software catering to analytics and advertising services.


1 Answers

If I had to do this I would first beautify the source code to make it more readable, then find any lines which set a cookie (e.g. by searching for the regex /(document)?\.cookie\s*=\s*/), then trace the origin of the value which is assigned.

like image 113
maerics Avatar answered Oct 20 '22 17:10

maerics