blockhosts 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/blockhosts.rb +12 -6
- data.tar.gz.sig +0 -0
- metadata +23 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67913c506d902bbe615aaeb54b23435d83c141e2c3ab38b8ca36c060794fbe25
|
4
|
+
data.tar.gz: 6c8eea9339fbd1c0cff02048f61409e1336de12984ab7d2d48f30711a26e44b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79b8895069300ae145792fe840fd44b98e6218be92689554174cb3be4422a703e1d8a00474afbdae087e4c38116548b42953fa1d82b4ec84e1ba307698d85a62
|
7
|
+
data.tar.gz: 52d8ef088571d3c02d07b11b50d9f55ab8b82a505c7d019bd2c677692afcd65d9b28cc0f3557e4dc3eb2ff9a83e4e794b13a8afab29e93cbebaae8e0f6e65c22
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/blockhosts.rb
CHANGED
@@ -2,19 +2,17 @@
|
|
2
2
|
|
3
3
|
# file: blockhosts.rb
|
4
4
|
|
5
|
-
|
6
5
|
require 'rxfhelper'
|
7
6
|
|
7
|
+
|
8
8
|
class Host
|
9
9
|
|
10
10
|
@ip = '127.0.0.1'
|
11
11
|
|
12
12
|
@file = case RUBY_PLATFORM
|
13
|
-
when /linux|darwin/
|
14
|
-
'/etc/hosts'
|
15
13
|
when /cygwin|mswin|mingw|bccwin|wince|emx/
|
16
14
|
'c:\windows\system32\drivers\etc\hosts'
|
17
|
-
else
|
15
|
+
else # /linux|darwin/
|
18
16
|
'/etc/hosts'
|
19
17
|
end
|
20
18
|
|
@@ -25,10 +23,10 @@ class Host
|
|
25
23
|
|
26
24
|
hashtag = hostname.sub(/^#/,'')
|
27
25
|
list, _ = RXFHelper.read(banlist)
|
28
|
-
list.lines.map {|hostx| "
|
26
|
+
list.lines.map {|hostx| "##{@ip} #{hostx.chomp} ##{hashtag}" }.join("\n")
|
29
27
|
|
30
28
|
else
|
31
|
-
"
|
29
|
+
"##{@ip} #{hostname} ##{hashtag}"
|
32
30
|
end
|
33
31
|
|
34
32
|
open(@file, 'a') { |f| f.puts s } unless File.read(@file).include? hostname
|
@@ -69,4 +67,12 @@ class Host
|
|
69
67
|
|
70
68
|
end
|
71
69
|
|
70
|
+
def self.rm(hashtag)
|
71
|
+
|
72
|
+
modify() do |line|
|
73
|
+
line.gsub(/^([^^]+##{hashtag.sub(/^#/,'')}[^$]+$)/,'')
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
72
78
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockhosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,8 +35,28 @@ cert_chain:
|
|
35
35
|
7vecf9qfrpZt4fjOajWBWWZEUQ3QKHva1uNegE75UqN77YfewLL+A+SrV0ORhL9q
|
36
36
|
/sJ0X03RC0pDp5fyhHmUoTyT
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-10-
|
39
|
-
dependencies:
|
38
|
+
date: 2018-10-21 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: rxfhelper
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.9'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.9.1
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.9'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.9.1
|
40
60
|
description:
|
41
61
|
email: james@jamesrobertson.eu
|
42
62
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|