
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Tomahawk provide you with a minimal http server, that can be started on the command line to serve static content.
npm install -g tomahawk
To serve the current directory using the default port 8080
tomahawk
To serve "web/public" from the current directory using the default port 8080
tomahawk --www=web/public
To use a different port (e.g. 3000)
tomahawk --port=3000
How can I prefix my static content with MyApp (e.g. http://localhost:8080/MyApp insead of the default http://localhost:8080/)
tomahawk --context=/MyApp
How about less logging?
tomahawk --level=error
tomahawk --config=config.development.json
or
tomahawk --headers='["Access-Control-Allow-Origin:*","Access-Control-Allow-Methods:GET,PUT,POST,DELETE","Access-Control-Allow-Headers:Content-Type","X-Frame-Options:ALLOWALL"]'
tomahawk --cgi='[{"route":"/echo","method":"POST","command":"/bin/sh", "args":["-c", "read line ; echo $line"], "encoding":"utf8"}]'
echo allo | curl -X POST -d @- http://localhost:8080/echo
Can I save the configration, to avoid typing it every time?
Your configuration file should look like:
{
"level" : "error",
"www" : ".",
"context" : "/MyApp",
"port" : 9000,
"headers" : [
"Access-Control-Allow-Origin:*",
"X-Frame-Options:ALLOWALL"
],
"cgi" : [
{
"route" : "/version",
"method" : "GET",
"command" : "/bin/sh",
"args" : ["-c", "echo '{\"version\":\"1.0.0\"}'"]
}
]
}
You can look at the sample code under the sample directory:
samples/sample_server.js:
var app = require('tomahawk').create({port:8080,routes:[__dirname + '/lib/routes']}).start();
samples/lib/routes.js':
module.exports = function () {
function routes(app, config, io) {
var database = {
captains : {
"jim" : "James Tiberius Kirk",
"picard" : "Jean-Luc Picard"
},
starShips : {
"jim": "NCC1701-A",
"picard": "NCC1701-D"
}
};
// GET
app.get('/api/v1/captain/:id?', function (req, res) {
var withStarship = req.query.starship === 'true';
if (req.params.id) {
res.json(withStarship ?
{id:req.params.id,name:database.captains[req.params.id], starship:database.starShips[req.params.id]} :
{id:req.params.id,name:database.captains[req.params.id]});
} else {
res.json(database.captains);
}
res.end();
});
// PUT
app.put('/api/v1/captain/:id', function (req, res) {
database.captains[req.params.id] = req.body;
io.sockets.emit('new:captain', {id:req.params.id, name:req.body}); // Optional, if you want to use websocket
res.json({id:req.params.id,operation:"put",status:"OK"});
res.end();
});
// DELETE
app.delete('/api/v1/captain/:id', function (req, res) {
delete database.captains[req.params.id];
io.sockets.emit('del:captain', {id:req.params.id}); // Optional, if you want to use websocket
res.json({id:req.params.id,operation:"delete", status:"OK"});
res.end();
});
}
return routes;
}();
Run:
node sample_server.js
FAQs
Minimal HTTP Server
We found that tomahawk 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.