Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I able to see the source code of this website www.samy.pl?

This website (www.samy.pl) uses some technique so that no one can inspect the code
(Ctrl+Shift+I) or view source (Ctrl+U). It can detect if you have opened the console or inspector the code automatically changes.

How this is possible?

like image 418
TPS kisan Avatar asked Apr 12 '17 23:04

TPS kisan


2 Answers

You could always save the website. In chrome open the menu -> more tools -> Save page as..

You should be able to run the html file in chrome, and use Dev Tools without it blocking you.

like image 138
Fio Avatar answered Oct 26 '22 01:10

Fio


hahaha, this is a good one, you should not expect less from samy!

Now I see why people think it is the wrong answer (the source get replaced if you do otherwise)

1.Navigate to site with inspector open there you end up with "No source for you! You found easter egg #7."

2.and then check the source to find Easter egg #2:

view-source:https://samy.pl

you will see:

/*
No source for you! Easter egg #2
*// AFTER SOME LONG WHITE SPACES HERE  /.source.replace(/.{7}/g,function(w){document.write(String.fromCharCode(parseInt(w.replace(/ /g,'0').replace(/   /g,'1'),2)))});

This is the way he loads the site(by injecting js), by replacing two type of white spaces for 1 and 0 and parsing that to char code by some regex and then that to string of course :D

https://de.wikipedia.org/wiki/Whitespace_(Programmiersprache)

If you paste that part to a js console, you will get the tags that loads the page.

enter image description here

ps. to see the rendered source, just load the page normaly and hit F12 after disabling javascript.

Have fun!

like image 23
pabbasian Avatar answered Oct 26 '22 01:10

pabbasian