Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
pip install pathlibs3
import boto3
from pathlibs3.pathlibs3 import S3Path
# Create a pathlibs3
client = boto3.client("s3", region_name="us-east-1")
bucket = "test-bucket"
# Create an object to s3://test-bucket/myfolder
s3_path_to_myfolder = S3Path(client, bucket, "myfolder/")
# You can also concatenate object
# Create an object to s3://test-bucket/myfile/random_file.txt
s3_path_to_random_file = s3_path_to_myfolder / "random_file.txt"
# Iter over this directory
for path in s3_path.iterdir():
print(path)
# Iter over this directory recursively
for path in s3_path.iterdir(recursive=True):
print(path)
>> s3_path_to_myfolder = S3Path(client, bucket, "myfolder/folder1/folder2")
>> s3_path_to_myfolder.parent
S3Path(client, bucket, "myfolder/folder1")
>> s3_path_to_myfolder.parents
[S3Path(client, bucket, "myfolder/folder1"), S3Path(client, bucket, "myfolder")]
>> s3_path_to_myfolder = S3Path(client, bucket, "myfolder/folder1/folder2/test.txt")
>> s3_path_to_myfolder.name
"test.txt"
>> s3_path_to_myfolder = S3Path(client, bucket, "myfolder/folder1/folder2/test.txt")
>> s3_path_to_myfolder.exists()
True
# Create an pathlibs3 object
s3_path_to_myfolder = S3Path(client, bucket, "myfolder/")
# Create a pathlib object
local_path = Path("/tmp/local_folder")
# Will download the s3 folder localy
S3Path.copy(s3_path_to_myfolder, local_path)
# You may also use string for local path
# Example: copy from s3 to local dir using string
S3Path.copy(s3_path_to_myfolder, "/tmp/local_folder")
# Create an pathlibs3 object
s3_path_to_myfolder = S3Path(client, bucket, "myfolder/")
# Create a pathlib object
local_path = Path("/tmp/local_folder")
# Will download the s3 folder localy
S3Path.copy(local_path, s3_path_to_myfolder)
# Create an pathlibs3 object
s3_path_to_myfolder = S3Path(client, bucket, "myfolder/")
# Create another pathlibs3 object
s3_path_to_anotherfolder = S3Path(client, bucket, "anotherfolder/")
# Will download the s3 folder localy
S3Path.copy(s3_path_to_myfolder, s3_path_to_anotherfolder)
# Create an pathlibs3 object
s3_path_to_myfolder = S3Path(client, bucket, "myfolder/")
s3_path_to_myfolder.delete()
# Create an pathlibs3 object
s3_path_to_myfolder = S3Path(client, bucket, "myfolder/")
s3_path_other_folder = S3Path(client, bucket, "myotherfolder/")
S3Path.move(s3_path_to_myfolder, s3_path_other_folder)
run test with poetry run python -m pytest
FAQs
S3 navigation using object, inspired by pathlib.Path
We found that pathlibs3 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.