import sys
import requests

if len(sys.argv) != 2:
	sys.exit()

BASE_URL = sys.argv[1]
CONFIRM_HASH = "cafebabe"

session = requests.session()

login_data = {
	"username": "sengler",
	"password": "bluejays",
	"form": "login",
	"submit": "Login"
}

r = session.post(BASE_URL + '/post.php', data=login_data)

RESPONSE_FILE_NAME = 'response.txt'
with open(RESPONSE_FILE_NAME, mode='w') as file:
	if r.history:
		response = r.history[0]
		file.write(response.text)

form_data = {
	"title": "Title",
	"content": "link",
	"type": "2",
	"form": "content",
	"submit": "Post"
}

r = session.post(BASE_URL + '/post.php', data=form_data)

print(r.text)

session.close()