Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A wrapper to do some easy logging and writing and parsing stuff from and to Google Spreadsheets.
npm install data-drive
Or
Clone the repo to your localhost
git clone git@github.com:RamonGebben/data-drive.git
var config = require('./config.json');
var DD = require('data-drive')( config );
DD.connect(function(){
DD.create( { "test": "testing", "test2": "OK" }, function(){
console.log( "done" );
} )
});
First you must create a doc to write to. Open your Drive and sign in.
Use this template to create a new sheet.
Next we need to configure the config.json
. The config expects the following values to be present:
"auth": {
"username": "example@gmail.com",
"password": "password"
},
"sheet": {
"name": "name of sheet",
"id": "optional id",
"worksheet": {
"name": "worksheet name",
"id": "optional id"
}
}
The sheet.id
and sheet.worksheet.id
are optional.
These will appear in the console when not given, after that you could add them to make the connection faster.
Because Google sheets provides us with a json we can't really work with the data gets remapped.
You can ajust the names of the columns in the config.json
. A mapping would look like this:
"mapping": {
"columns":[
["1", "key"],
["2", "key1"],
["3", "key2"]
]
}
{
"1": {
"1": "pizza",
"2": "koffie",
"3": "kebab"
}
}
{
"key": "pizza",
"key1": "koffie",
"key2": "kebeb",
"id": 1
}
The action have a very simple syntax:
DD.name_of_action( [id], data, function(){
//Gets executed when done.
});
Although some action may require an id like:
Because else we wouldn't not know which record to update.
The GET
action requires an id or an query to find a array of records to match the query.
// With an ID
DD.get( id, function(){
//Gets executed when done.
});
// => {} returns an Object
// With an query
// NOTE: Only `===` is supported at this point
DD.get( 'key === pizza', data, function(){
//Gets executed when done.
});
// => [{}, {}, {}] returns an Array of Objects
Adds a new record field to the db and updates it with the data that is given.
DD.create( data, function(){
//Gets executed when done.
});
Update a record.
DD.update( id, data, function(){
//Gets executed when done.
});
Removal is not possible. The record field will be made empty so count as inactive.
DD.destroy( id, function(){
//Gets executed when done.
});
If you want to provide al the info to a client side application you can just dump the entire db.
DD.db() // return entire db
To run the tests, first cd
into the test dir, edit the test_config.json
and run:
npm test
FAQs
A simple wrapper to write to GDrive
We found that data-drive 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.