
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
ftprelay
is a lightweight Python module that provides a simple framework for setting up a minimal, non-persisting FTP server whose single purpose is to execute custom code on uploaded files before discarding them.
It was developed with the goal of retrofitting older devices or software that exclusively support FTP upload for file transfer, enabling a broader range of applications.
Install ftprelay
using pip:
pip install ftprelay
process_file()
method in a custom class that inherits from FileProcessor
. This method defines how
uploaded files should be processed.authenticate()
method in a custom class that inherits from Authenticator
. This method should either
raise an AuthenticationFailedError
or, upon successful authentication, return an instance of the custom FileProcessor
that dictates how the file should be processed for this user. relay = FTPRelay(authenticator=MyCustomAuthenticator(), host='127.0.0.1', port=21)
relay.start()
This initializes an FTP server, where logins are authenticated using your custom Authenticator. Upon successful authentication, uploaded files are temporarily stored. The storage path of each file is then passed to the associated FileProcessor class returned by the Authenticator. Finally, the files are promptly deleted after processing.
A basic example for a FTP relay that sends the uploaded files via email to a recipient address depending on the user.
from dataclasses import dataclass
from pathlib import Path
from ftprelay import AuthenticationFailedError, Authenticator, FileProcessor, FTPRelay
@dataclass
class CustomFileProcessor(FileProcessor):
recipient_email: str
def process_file(self, path: Path) -> None:
# Placeholder code: send email with attachment
send_email(to=self.recipient_email, attachment=path)
class CustomAuthenticator(Authenticator):
def authenticate(self, username: str, password: str) -> FileProcessor:
# Placeholder code: verify credentials
if verify(username, password):
return CustomFileProcessor(recipient_email=f"{username}@example.org")
else:
raise AuthenticationFailedError()
# Instantiate and start the FTPRelay
relay = FTPRelay(authenticator=CustomAuthenticator(), host='127.0.0.1', port=21)
relay.start()
ftprelay
is distributed under the terms of the MIT License.
FAQs
A framework for mock FTP servers that relay uploaded files
We found that ftprelay demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.