Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
atrigger
Advanced tools
Readme
A very simple A Trigger JavaScript library that helps you schedule and manage tasks using A Trigger's API.
A Trigger is a tool/service that helps you schedule periodic and fixed-time tasks by sending a GET request to a given url. It is a very simple and considerably flexible alternative to using Cron for job scheduling.
I use it a lot, so I wrote this simple abstraction to make my life easier and hopefully yours too.
This module helps you create, delete, pause, and resume tasks with ease and without worrying about URI Encoding, enormous URIs, GET requests, or anything other than your actual work. Also, with this module you can check if an IP address belongs to an atrigger.com server so you can verify the authenticity of a task call.
This is basically a simple abstraction of the A Trigger Rest API. The main purpose of this mini-project was to create and publish my first npm module as I learn more and more about Node.js and JavaScript. But I didn't want to do something useless, so I built this. :smiley:
atrigger
is very simple to use:
// Require the atrigger module
var ATrigger = require('atrigger');
// Create a new ATrigger client instance with your API Key and Secret
var tasks = new ATrigger({
APIKey: 'API_KEY',
APISecret: 'API_SECRET'
});
// Create a new task
tasks.create({
url: 'http://www.krismuniz.com/',
timeSlice: '10min',
count: 10,
tags: {
'title': 'call-my-site',
'id': 'OtftvvsJ'
}
});
You can handle request errors and API responses, too.
tasks.create({
url: 'http://www.krismuniz.com/',
timeSlice: '10min',
count: 10,
}, function(err, res) {
if (err) {
// Handle error
} else {
// Do stuff with APIs response
}
});
Installing the atrigger
module is as simple as installing any other npm module:
$ npm install atrigger
create
methodCreates a new task given a specific set of parameters. The callback function is optional.
tasks.create({
// parameters
}, callback(err, res));
url
([string]
): The target url that A Trigger will call at defined timeSlice
. Note: There is no need to use URIEncode(), the module does that for you.
timeSlice
([string]
): The time frequency at which your task needs to be executed. (e.g. 'Xminute', 'Xhour', 'Xday', 'Xmonth', 'Xyear'
where X
is a positive integer)
tags
([object]
): An object containing tags (e.g. { tagname: tagvalue, tagname2: tagvalue2 }
). You need to tag your tasks for future identification and to control them using the API.
retries
([integer]
): How many times A Trigger should try if your server failed (or was down)? Default value: 3
count
([integer]
): How many cycles should be repeated? For an infinite amount of times write -1
. Read more at count parameter (Wiki).
first
([string from date in ISO 8601 format]
): When should the first call be made? You are not required to set time value by default. Read more at first parameter (Wiki). Hint: use .toISOString()
to convert a date to the proper format.
delete
methodDeletes all tasks containing a specified set of tags. The callback function is optional.
tasks.delete({
// parameters
}, callback(err, res));
tags
([object]
): An object containing tags (e.g. { tagname: tagvalue, tagname2: tagvalue2 }
). You need to tag your tasks for future identification and to control them using the API.pause
methodPauses all currently-active tasks that contain a specified set of tags. The callback function is optional.
tasks.pause({
// parameters
}, callback(err, res));
tags
([object]
): An object containing tags (e.g. { tagname: tagvalue, tagname2: tagvalue2 }
). You need to tag your tasks for future identification and to control them using the API.resume
methodResumes all currently-paused tasks that contain a specified set of tags. The callback function is optional.
tasks.resume({
// parameters
}, callback(err, res));
tags
([object]
): An object containing tags (e.g. { tagname: tagvalue, tagname2: tagvalue2 }
). You need to tag your tasks for future identification and to control them using the API.verifyRequest
methodPass an IP address and the A Trigger API will respond if the call comes from an A Trigger server. The callback function is required (otherwise the method's existence would be pointless).
tasks.verifyRequest({
ip: '192.168.1.1'
}, callback(err, res));
ip
([string]
): The IP address you want to verify.Want to run some tests?
$ npm install
$ npm test
Copyright (c) 2015 Kristian Muñiz [http://krismuniz.com/]
I am not affiliated in any way to A Trigger and this library is not official. I just use this service and wanted to build this library for educational and productivity reasons.
FAQs
A Trigger API JavaScript library
We found that atrigger demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.