user219882
user219882

Reputation: 15834

Is it possible to download PHP script from a web page with wget?

If I try wget <url> it downloads the resolved page. But I want to download the original script. Is this possible?

Upvotes: 2

Views: 18274

Answers (4)

artemonster
artemonster

Reputation: 763

"Officially" - no.
Through "hacking" - yes. If a website allows to download some content via /download.php?src=path_to_file script, AND it was poorly coded, then you could request to download, say, index.php file.

Check this out: https://owasp.org/www-community/attacks/Path_Traversal

Upvotes: 2

Jfdev
Jfdev

Reputation: 189

This is not possible, the webserver doesn't output the PHP script. The webserver parses it serverside and writes the response of that to the client.

Upvotes: 2

Daveo
Daveo

Reputation: 19872

No this is not possible, and would be a huge security issue if it was.

The only way this would be possible is if the web server (Apache) was not configured correctly

Upvotes: 4

Pointy
Pointy

Reputation: 413682

No, and thank goodness for that. The server is completely in control of how it responds to your HTTP requests.

Strictly speaking, you can't tell whether it's PHP on the other end of the wire in the first place.

Upvotes: 5

Related Questions