-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9164874
Showing
10 changed files
with
5,330 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
node_modules | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# > docker run -i -t --security-opt seccomp:unconfined -v $PWD:/var/opt/src $IMAGE | ||
|
||
FROM ubuntu:14.04 | ||
|
||
# Common enviromnent variables | ||
ENV TERM=xterm | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Add proper locales | ||
RUN locale-gen ru_RU.UTF-8 | ||
RUN dpkg-reconfigure debconf locales | ||
ENV LANG=ru_RU.UTF-8 LC_ALL=ru_RU.UTF-8 LANGUAGE=ru_RU:ru | ||
|
||
# apt-get configuration | ||
RUN rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update --fix-missing | ||
|
||
# Install requred pacakges | ||
# strace required "--security-opt seccomp:unconfined" option on container running | ||
RUN apt-get update --fix-missing && \ | ||
apt-get install -y curl \ | ||
strace | ||
|
||
# Install NodeJs | ||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs | ||
|
||
RUN /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Aleksandr Komlev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# ctrace | ||
well-formatted and improved trace system calls and signals | ||
|
||
<img src="http://g.recordit.co/AKdHxKdzqy.gif" width="45%"/> | ||
<img src="http://g.recordit.co/66Xzz2TGHS.gif" width="45%"/> | ||
|
||
## Why? | ||
Awesome tools ```strace``` and ```dtruss``` have only one drawback: too much information which is hard to understand without additional sources of information and various configuration options. ```ctrace``` resolves it. | ||
|
||
```ctrace``` are indispensable in the following cases | ||
- Debugging performance issues or unhandled errors and exceptions in own code or someone else's code | ||
- Learning OS kernel | ||
|
||
|
||
## Features | ||
|
||
- Supported platforms: OSx (dtruss), Linux (strace) | ||
- Trace command or attach to process (with forks following) | ||
- Syscall details in output (number, description, synonyms, is it platform specific syscall) <br> ``` pread (preadv), 534 -- read or write data into multiple ``` | ||
- Resolving errno in syscall result <br> ```Err#22 -> EINVAL : Invalid argument``` (only OSx) | ||
- Prints by default only syscall with errors, with ```-v``` prints all output | ||
- Filter output with syscall list ``` -f "lstat,open" ``` | ||
|
||
## Installation | ||
```sh | ||
$> npm install -g ctrace | ||
``` | ||
|
||
``` | ||
$> ctrace --help | ||
Usage: ctrace [options] | ||
ctrace - well-formatted and improved trace system calls and signals | ||
Options: | ||
-h, --help output usage information | ||
-V, --version output the version number | ||
-p, --pid [pid] process id to trace | ||
-c, --cmd [cmd] command to trace | ||
-f, --filter [syscall,] trace syscall only from list | ||
-v, --verbose print all syscalls (by default only with errors) | ||
Examples: | ||
$ ctrace -p 2312 -v | ||
$ ctrace -c "ping google.com" | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
### OSx : Dtrace cannot control executables signed with restricted entitlements | ||
|
||
As you may now Apple released their new OS X revision 10.11 this year with a great security feature built-in: System Integrity Protection. In a nutshell, this mechanism protects any system data and important filesystem components (like /System or /usr) from being modified by user; even if they are root. SIP also disables any use of code-injection and debugging techniques for third-party software, so some of your favorite hacks may not work anymore. | ||
... | ||
|
||
#### Completely disable SIP | ||
|
||
Although not recommended by Apple, you can entirely disable System Integrity Protection on you Mac. Here's how: | ||
|
||
Boot your Mac into Recovery Mode: reboot it and hold cmd+R until a progress bar appears. | ||
Choose the language and go to Utilities menu. Choose Terminal there. | ||
Enter this command to disable System Integrity Protection: | ||
``` | ||
$> csrutil disable | ||
``` | ||
It will ask you to reboot — do so and you're free from SIP! | ||
|
||
http://internals.exposed/blog/dtrace-vs-sip.html#fnref1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require('../index')(); |
Oops, something went wrong.