recot 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/README.md +66 -7
- data/bin/recot +5 -1
- data/lib/recot/commands.rb +7 -1
- data/lib/recot/commands/interactive_ui.rb +5 -1
- data/lib/recot/commands/rack_server.rb +1 -4
- data/lib/recot/utils/browser_util.rb +30 -0
- data/lib/recot/utils/clipboard_util.rb +30 -0
- data/lib/recot/utils/screencap_util.rb +27 -0
- data/lib/recot/version.rb +1 -1
- data/recot.gemspec +2 -0
- data/template/index.html.erb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe31131b31eeabb365a4d3b1fb8b93604205dac9
|
4
|
+
data.tar.gz: 439362ae55e5316cffc7dc4cb46e2088d0e004a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb63a9558b651e5ffa1ed7222409630fb17ce8111ed5010be344b8262da0c771309f0aaafa5efe6eafd2c22c61250d3f265b52de84ad8fefac63503e7a287eef
|
7
|
+
data.tar.gz: 69849627fa9cb5bfef103e049cef011d17680cf3aff8c59da1a6808be1754120163d0fa29b59d9a5840b1e0b75187ad61d7aef976a8a1b5d1a919d162d29200b
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -20,11 +20,41 @@ gem install recot
|
|
20
20
|
```
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
#### Recot command
|
24
|
+
|
25
|
+
```sh
|
26
|
+
$ rect <command>
|
27
|
+
```
|
28
|
+
|
29
|
+
|Command|Description|
|
30
|
+
|:------|:----------|
|
31
|
+
|start|Start recot to collect evidence.|
|
32
|
+
|cleanup|Clean up cache.|
|
33
|
+
|destroy|Delete all file.|
|
34
|
+
|
35
|
+
If you want to delete cacche.
|
36
|
+
run the following command:
|
37
|
+
|
38
|
+
```sh
|
39
|
+
$ recot cleanup
|
40
|
+
```
|
41
|
+
|
42
|
+
If you want to delete all file and directory,
|
43
|
+
run the following command:
|
44
|
+
|
45
|
+
```sh
|
46
|
+
$ recot destroy
|
47
|
+
Sure you want to delete all the files? [y/N] > y
|
48
|
+
Removed all dependency files.
|
49
|
+
```
|
50
|
+
|
51
|
+
#### Start recot
|
52
|
+
|
23
53
|
To begin the test with the following command:
|
24
54
|
|
25
55
|
```sh
|
26
56
|
$ recot start
|
27
|
-
Start recot ver 0.2.
|
57
|
+
Start recot ver 0.2.1
|
28
58
|
|
29
59
|
____ __
|
30
60
|
/ __ \___ _________ / /
|
@@ -33,6 +63,17 @@ Start recot ver 0.2.0
|
|
33
63
|
/_/ |_|\___/\___/\____/\__/
|
34
64
|
```
|
35
65
|
|
66
|
+
###### Options
|
67
|
+
|
68
|
+
`recot start` command has the following options:
|
69
|
+
|
70
|
+
|Option|Command|Description|Default|
|
71
|
+
|:-----|:------|:----------|:------|
|
72
|
+
|port|-p, --port|Set server port.|9292|
|
73
|
+
|open|-o, --open|Open top page by default browser.|nil|
|
74
|
+
|
75
|
+
###### Interactive command
|
76
|
+
|
36
77
|
Enter the test number as follows:
|
37
78
|
|
38
79
|
```sh
|
@@ -72,6 +113,21 @@ access the http://localhost:9292/__output/index.html
|
|
72
113
|
When you click the image to display the popup.
|
73
114
|

|
74
115
|
|
116
|
+
If you want to output the contents of the clipboard as a log, run the following command:
|
117
|
+
|
118
|
+
```sh
|
119
|
+
[2](recot) > paste <filename>
|
120
|
+
```
|
121
|
+
|
122
|
+
e.g.
|
123
|
+
|
124
|
+
※ State that has already been copied to the clipboard.
|
125
|
+
```sh
|
126
|
+
[1](recot) > A100
|
127
|
+
[2](recot) > paste copy.log
|
128
|
+
```
|
129
|
+
`copy.log` is output to the location of the `__output/resource/A100/`.
|
130
|
+
|
75
131
|
If you want to delete the previous evidence, run the following command:
|
76
132
|
|
77
133
|
```sh
|
@@ -90,12 +146,6 @@ If you want to test the end, run the following command:
|
|
90
146
|
[4](recot) > exit
|
91
147
|
```
|
92
148
|
|
93
|
-
If you want to delete all file and directory,
|
94
|
-
run the following command:
|
95
|
-
|
96
|
-
```sh
|
97
|
-
[5](recot) > destroy
|
98
|
-
```
|
99
149
|
|
100
150
|
## Configuration
|
101
151
|
|
@@ -125,6 +175,15 @@ theme: "white"
|
|
125
175
|
```
|
126
176
|
|
127
177
|
|
178
|
+
> ProjectName
|
179
|
+
|
180
|
+
You can set a project name for evidecnce.
|
181
|
+
|
182
|
+
Set the following in 'config.yml'.
|
183
|
+
```yml
|
184
|
+
project_name: "Your project name"
|
185
|
+
```
|
186
|
+
|
128
187
|
## Licence
|
129
188
|
|
130
189
|
[MIT](https://github.com/tcnksm/tool/blob/master/LICENCE)
|
data/bin/recot
CHANGED
@@ -13,8 +13,12 @@ class RecotExecutable
|
|
13
13
|
|
14
14
|
cmd.desc 'Server listen port'
|
15
15
|
cmd.flag [:p, :port], default_value: 9292
|
16
|
+
|
17
|
+
cmd.desc 'Open default browser'
|
18
|
+
cmd.switch [:o, :open]
|
19
|
+
|
16
20
|
cmd.action do |_, options, _|
|
17
|
-
Recot::Commands.start(options[:port])
|
21
|
+
Recot::Commands.start(options[:port], options[:open])
|
18
22
|
end
|
19
23
|
end
|
20
24
|
|
data/lib/recot/commands.rb
CHANGED
@@ -5,6 +5,7 @@ require 'recot/commands/guard_server'
|
|
5
5
|
require 'recot/commands/interactive_ui'
|
6
6
|
require 'recot/commands/listener'
|
7
7
|
require 'recot/utils/recot_util'
|
8
|
+
require 'recot/utils/browser_util'
|
8
9
|
|
9
10
|
module Recot
|
10
11
|
module Commands
|
@@ -13,7 +14,7 @@ module Recot
|
|
13
14
|
#
|
14
15
|
# == Parameters:
|
15
16
|
# Server listen port.
|
16
|
-
def self.start(port
|
17
|
+
def self.start(port, open)
|
17
18
|
|
18
19
|
# Prepare.
|
19
20
|
Utils::RecotUtil.prepare
|
@@ -29,6 +30,11 @@ module Recot
|
|
29
30
|
# Start listener.
|
30
31
|
Listener.new.run
|
31
32
|
|
33
|
+
# Open browser.
|
34
|
+
if open
|
35
|
+
Utils::BrowserUtil.open(port)
|
36
|
+
end
|
37
|
+
|
32
38
|
# Start interactive operate.
|
33
39
|
InteractiveUi.new.start
|
34
40
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require 'recot/utils/recot_util'
|
3
|
+
require 'recot/utils/clipboard_util'
|
3
4
|
require 'recot/commands/recent_cancel'
|
4
5
|
require 'recot/commands/current_clear'
|
5
6
|
require 'recot/commands/tree_generator'
|
@@ -17,7 +18,7 @@ module Recot
|
|
17
18
|
count = 1
|
18
19
|
loop do
|
19
20
|
|
20
|
-
print "[#{count}](recot) > "
|
21
|
+
print "\e[33m[#{count}](recot) > \e[0m"
|
21
22
|
input_str = STDIN.gets.chomp
|
22
23
|
case input_str
|
23
24
|
when /[Ee]xit/
|
@@ -28,6 +29,9 @@ module Recot
|
|
28
29
|
when /[Cc]lear/
|
29
30
|
# Clear current test no.
|
30
31
|
CurrentClear.clear
|
32
|
+
when /[Pp]aste ([a-zA-Z\d.]*)/
|
33
|
+
# Output file from clipboard.
|
34
|
+
Utils::ClipboardUtil.paste_out($1)
|
31
35
|
when /\d{1,3}(-\d{1,3})?(-\d{1,3})?/
|
32
36
|
# Generate tree.
|
33
37
|
TreeGenerator.generate(input_str)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Recot
|
4
|
+
module Utils
|
5
|
+
class BrowserUtil
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# Open browser at argument url.
|
10
|
+
#
|
11
|
+
# == Parameters:
|
12
|
+
# Server listen port.
|
13
|
+
def open(port)
|
14
|
+
|
15
|
+
url = "http://localhost:#{port}/__output/index.html"
|
16
|
+
|
17
|
+
if RUBY_PLATFORM =~ /darwin/
|
18
|
+
# Mac OS
|
19
|
+
system "open #{url}"
|
20
|
+
elsif RUBY_PLATFORM =~ /mswin(?!ce)|mingw|cygwin|bccwin/
|
21
|
+
# Windows
|
22
|
+
system "start #{url}"
|
23
|
+
else
|
24
|
+
puts "Unsupport platform of open browser."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'clipboard'
|
3
|
+
|
4
|
+
module Recot
|
5
|
+
module Utils
|
6
|
+
class ClipboardUtil
|
7
|
+
|
8
|
+
class << self
|
9
|
+
|
10
|
+
# Output file from clipboard.
|
11
|
+
#
|
12
|
+
# == Parameters:
|
13
|
+
# A file name
|
14
|
+
def paste_out(filename)
|
15
|
+
|
16
|
+
text = Clipboard.paste
|
17
|
+
unless text.to_s.empty?
|
18
|
+
path = "#{Recot.basket_dir}/#{filename}"
|
19
|
+
open(path, 'w') do |f|
|
20
|
+
f.write text
|
21
|
+
end
|
22
|
+
else
|
23
|
+
puts "\e[31mClipboard empty!\e[0m"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Recot
|
4
|
+
module Utils
|
5
|
+
class ScreencapUtil
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# Capture full screen.
|
10
|
+
#
|
11
|
+
# == Parameters:
|
12
|
+
# Output filename
|
13
|
+
def capture(filename)
|
14
|
+
|
15
|
+
if RUBY_PLATFORM =~ /darwin/
|
16
|
+
# Mac OS
|
17
|
+
system("screencapture -x basket/#{filename}")
|
18
|
+
elsif RUBY_PLATFORM =~ /mswin(?!ce)|mingw|cygwin|bccwin/
|
19
|
+
# Windows
|
20
|
+
else
|
21
|
+
puts "Unsupport platform of screencapture."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/recot/version.rb
CHANGED
data/recot.gemspec
CHANGED
@@ -29,6 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency "listen", "= 3.0.6"
|
30
30
|
spec.add_runtime_dependency "activesupport", "~> 4.0"
|
31
31
|
spec.add_runtime_dependency "wdm", ">= 0.1.0" if Gem.win_platform?
|
32
|
+
spec.add_runtime_dependency "clipboard", "~> 1.1"
|
33
|
+
spec.add_runtime_dependency "ffi", "~> 1.9" if Gem.win_platform?
|
32
34
|
|
33
35
|
# Development Dependencies
|
34
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/template/index.html.erb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- slowhand0309
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '4.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: clipboard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.1'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.1'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rake
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,7 +184,10 @@ files:
|
|
170
184
|
- lib/recot/tasks/indexdoc_task.rb
|
171
185
|
- lib/recot/tasks/resdoc_task.rb
|
172
186
|
- lib/recot/tasks/sync_task.rb
|
187
|
+
- lib/recot/utils/browser_util.rb
|
188
|
+
- lib/recot/utils/clipboard_util.rb
|
173
189
|
- lib/recot/utils/recot_util.rb
|
190
|
+
- lib/recot/utils/screencap_util.rb
|
174
191
|
- lib/recot/version.rb
|
175
192
|
- recot.gemspec
|
176
193
|
- template/css/lightbox.min.css
|