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.
Table of Contents
pip install django-commands2
INSTALLED_APPS = [
...
'django_commands',
]
LOGGING = {
"loggers": {
"django_commands": {
...your custom level, handles config...
}
}
}
DJANGO_COMMANDS_ALLOW_REMOTE_CALL = [
"slow_command", # add slow_command if you want to run unittest
<your command>
]
path('api/django-commands/', include("django_commands.urls")),
import requests
requests.post("/api/django-commands/call-command", {"command": "slow_command"})
any exception will be logged in the autologcommand
<yourapp/management/commands/command_name.py>
from django_commands import AutoLogCommand
class Command(AutoLogCommand):
def handle(self):
<write your code, any exception will be logged>
MultiTimesCommand will run multi times according to INTERVAL
and MAX_TIMES
. You can easily use this command to realize a crontab job every 1 second.
class Command(MultiTimesCommand):
INTERVAL = 1 # default 1
MAX_TIMES = 60 # default 60
def handle(self):
<this handle function will run 60 times>
This command does not consider the running time of your code. It will just run 60 times, and during each execute, wait 1 second
DurationCommand will run your commands over and over again until the running time exceed the configuration
import datetime
class Commmand(DurationCommand):
INTERVAL = 1
DURATION = datetime.timedelta(minutes=1)
def handle(self, *args, **kwargs):
<your code>
UniqueCommand can assert that only one command instance is running
How it works? Every time the command executes:
import time
from django_commands.commands import UniqueCommand
class Command(UniqueCommand):
def handle(self):
print("I'm running. In the next 5 seconds, you cannot execute this command. It will exist directly")
time.sleep(5)
print("I'm running")
raise Exception("even error occurs, this task will be set finished")
django-commands
is distributed under the terms of the ONLY USE NO PRIVATE CHANGE LICENSE license.
Anyone can use pip install django-commands
to use this project by any meaning as long as you keep the source code unchanged.
You are not allowed to change the source code without publishing your change.
Here publishing means you:
fork this project from github and keep your change available to public on the github
FAQs
Unknown package
We found that django-commands2 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.