waffle-maker 0.1.1 → 0.1.2
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/README.md +11 -5
- data/lib/waffle/maker.rb +1 -1
- data/lib/waffle/maker/version.rb +1 -1
- data/lib/waffle/maker/waf.rb +7 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71db571599237aa72ae48350e7d1d6436b4d695d915ec0a65c1aa1af0eefe6d9
|
4
|
+
data.tar.gz: 488435761c228e78e9aa713af706f7c650310c042501a769bb59abb1167cc86c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba73930d703b1725ec8fe204b4c8d77b2b8223b38afda57006c2f1290ff62f50c97b740366cf04d4f5294e4107061286b8dc4037aba6b7568d4474895e1f1e0a
|
7
|
+
data.tar.gz: f3174679237267adc0b8d0344bf45164250be567f5372d232955036f9e1fcf0df35fbe62ac11c1148253caa521fe7d13e28c01eb968791242ffa8b9c61400882
|
data/README.md
CHANGED
@@ -24,16 +24,22 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
By passing the WAF log from the standard input, the log that matches the route is written to the standard output.
|
28
|
+
|
29
|
+
```sh
|
30
|
+
$ bundle exec rake waffle:filter < alert-201912.txt
|
29
31
|
```
|
30
32
|
|
31
|
-
|
33
|
+
Depending on the execution environment, you may need to pre-convert the character encoding of the log.
|
32
34
|
|
33
|
-
```
|
34
|
-
$ iconv -f
|
35
|
+
```sh
|
36
|
+
$ iconv -f CP932 -t UTF-8 < alert-201912.txt | bundle exec rake waffle:filter
|
35
37
|
```
|
36
38
|
|
39
|
+
with options
|
40
|
+
- `-f`: Specify the column number (offset) that contains the Rails route path. default is `2`.
|
41
|
+
- `-w`: Specify the column number (offset) that contains the path in the WAF log. default is `2`.
|
42
|
+
|
37
43
|
## Contributing
|
38
44
|
|
39
45
|
Bug reports and pull requests are welcome on GitHub at https://github.com/chibicco/waffle-maker.
|
data/lib/waffle/maker.rb
CHANGED
data/lib/waffle/maker/version.rb
CHANGED
data/lib/waffle/maker/waf.rb
CHANGED
@@ -16,14 +16,13 @@ module Waffle
|
|
16
16
|
# { raw: "2019/01/01 01:01:01\t8.8.8.8\t/users\t攻撃\t○", path: "/users" },
|
17
17
|
# ...
|
18
18
|
# ]
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
19
|
+
def each(&_block)
|
20
|
+
$stdin.each(chomp: true) do |line|
|
21
|
+
o = {
|
22
|
+
raw: line,
|
23
|
+
path: line.split(/#{parse_symbol}/)[path_position]
|
24
|
+
}
|
25
|
+
yield o
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
@@ -31,12 +30,6 @@ module Waffle
|
|
31
30
|
def parse_symbol
|
32
31
|
ENV.fetch("IFS", "\t")
|
33
32
|
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def readlines
|
38
|
-
@readlines ||= $stdin.readlines
|
39
|
-
end
|
40
33
|
end
|
41
34
|
end
|
42
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waffle-maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chibicco
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|