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.
TTYCoke lets one modify the colorset of a running program (that display output to the command-line) based on predefined regular expression. Basically it's wrapper around the program, executing it and parsing its stdout stream (where it will apply the matching rules/colors).
Initial disclaimer! This mess is raw, like sushi. So, haters to the left.
anyway,
For specific Ruby version requirements, see the Travis build. ATM > 1.9.
With RubyGems, simply open a terminal and type:
$ {sudo} gem install ttycoke
Local installation:
Download the tarball package and:
$ tar -xvzf ttycoke-{version}.tgz
or
$ git clone https://github.com/jpablobr/ttycoke.git
then
$ cd ttycoke-{version}
$ {sudo} rake install
Now you are ready to start coking!
$ ttycoke {program-name}
If the program exist in the config file, it will use its rules to ttycoke
it, otherwise it will fallback to its normal execution.
You can also define your own rules for things such as tailing
your logs! Something like the following should work:
Create an executable shell script and name it lets say, my_awesome_app_logs.sh
with:
#!/bin/sh
tail -f ~/apps/my_awesome_app/log/**/*.log
Then in your terminal you can ttycoke
it as such:
$ ttycoke my_awesome_app_logs.sh # <3<3<3
if you were creative enough, you'll be seeing rainbows!
Again, it's just a wrapper around the program, It just parses it stdout stream, so its capable of much more!
The following rake task will copy the ttycoke/config/config.yaml
file to your $HOME
directory as .ttycokerc
.
$ rake setup
This file contains the regular expression rules and it's also where you'll be adding yours!
Basically it's just 1:1 match to the specified colors in the regular expression groups. So for example, with the following rule:
lsmod:
regex: !ruby/regexp
/^(?<green>\w+)(?<uncolored>\s+)(?<blue>\d+)(?<uncolored>\s+)(?<yellow>\d+)(?<magenta>.+)/
the lsmod program will be matched as follows: (I know kind of obvious)
'/^(?<green>\w+)(?<uncolored>\s+)(?<blue>\d+)(?<uncolored>\s+)(?<yellow>\d+)(?<magenta>.+)/'
| | | | | |
| | | | | \_: magenta
| | | | \_: yellow
| | | \_: uncolored
| | \_:blue
| \_:uncolored
\_:green
Based on that you can now take it a bit further and for example the following will create a green/red TDD kind of output:
((?<green>success)|(?<red>fail|error))
The first screenshot is based of the following:
tail_tork_logs:
-
results:
regex: !ruby/regexp
/^(?<underscore>Finished.*)/
error:
regex: !ruby/regexp
/(?<red>.+(Error|Failure):)/
expected:
regex: !ruby/regexp
/(?<blue>--- expected)/
expected-string:
regex: !ruby/regexp
/(?<blue>-\".+)/
actual:
regex: !ruby/regexp
/(?<red>\++ actual)/
actual-string:
regex: !ruby/regexp
/(?<red>\+\".+)/
at:
regex: !ruby/regexp
/(?<on_yellow>@.+)/
stats:
regex: !ruby/regexp
/(?<white>\d+ tests, )(?<green>\d+ assertions, )(?<magenta>\d+ failures, )(?<red>\d+ errors, )(?<yellow>\d+ skips)/
and the tail_tork_logs
looks like this:
#!/bin/sh
tail -f log/test/**/*.log
That's just from tailing
the ouput of the Tork continuous testing framework.
Copyright (c) 2012 Jose Pablo Barrantes. See LICENSE for details.
FAQs
Unknown package
We found that ttycoke 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.