tarbit 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 117fb55a177b3ee42523343f68f5dd0cfb703748ce912fab803b200c416e41d3
4
- data.tar.gz: bf004f4ee1b84ba682ea5c5b3d8011181ec464cc8b945ab721cd81bb92fe7215
3
+ metadata.gz: 1574446bdae0127464b1b8e067a14cbc3e55a74cf5b9d35aa81d133715a5f093
4
+ data.tar.gz: 1dfddc4c58650c09b3b19fe1721aa755b60285484aade4ca74eb76c44006e463
5
5
  SHA512:
6
- metadata.gz: a5595aac91a471e9916c77060c549481213a814ea13a0879f553df1e4d3240ac2a78b792fa0e8b36b679ddfbb4715f14a0dc8a08bc33a9f0298bd9a2293e4a55
7
- data.tar.gz: 4974b6a89e9c0e007d70f908311f029bc97342d9a80f46111bdf8411114d271b0defe81cf4b8ae61c0f98def606cd08a89fa0ba91ddf0a1fb2b2a3a54b306e58
6
+ metadata.gz: b5959104833e64e3f58aec8ce6dd9e75a602f23aeda1a22053951c6b0f70246ad0ab743152abef845397e77312db918cee524eb9ceb30412d3e9cc23e8f8580e
7
+ data.tar.gz: b12add83ed57bc6101c83b01fc6902b387b063f7453dd8a483b6a49b7b47bde529b1780c4ee2b03240afc059933b0aab89adc08a64c2c98d132b7f9fb03044c4
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tarbit (1.0.8)
4
+ tarbit (1.0.9)
5
5
  async-io
6
6
  commander
7
7
  gruff
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2020 Niklas Helge Hanft
2
+
3
+ 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:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ 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.
@@ -0,0 +1,92 @@
1
+ # Tarbit - A async ruby tcp tarpit
2
+
3
+ ## Introduction
4
+
5
+ Tarbit is a tcp tarpit written in ruby. It can slow down automated ssh/http/tcp "attacks" or bot connections.
6
+ It is designed to consume a very little amount of cpu and memory. Tarbit can also generate statistic images.
7
+
8
+ *"Red Wood Cutting", Vladimir Kush*
9
+
10
+ !["Red Wood Cutting", Vladimir Kush](.assets/red-wood-cutting_vladimir-kush.jpg)
11
+
12
+ Tarbit is heaviliy inspired by endlessh, the python version, feel free to take a look: https://nullprogram.com/blog/2019/03/22/
13
+
14
+ ## Installation
15
+
16
+ ```
17
+ gem install tarbit
18
+ ```
19
+
20
+ You can now run tarbit manually (you can also omit the default params):
21
+
22
+ The interval option marks the seconds until the statistics are written to disk.
23
+
24
+ ```
25
+ tarbit serve --port 22 --interval 1800
26
+ ```
27
+
28
+ ## Advanced
29
+
30
+ Create a systemd service
31
+
32
+ Verify your tarbit executable: (change the path `bin` to `wrapper` within the systemd `ExecStart` )
33
+
34
+ ```
35
+ which tarbit
36
+ ```
37
+
38
+ ```bash
39
+ [Unit]
40
+ Description=Tarbit - ruby ssh tarpit
41
+
42
+ [Service]
43
+ Type=simple
44
+ ExecStart=/usr/local/rvm/gems/ruby-2.6.5/wrappers/tarbit serve
45
+ AmbientCapabilities=CAP_NET_BIND_SERVICE
46
+
47
+ [Install]
48
+ WantedBy=multi-user.target
49
+ ```
50
+
51
+ Create a cron job for making statistic snapshots:
52
+
53
+ Again make sure the path has changed `bin` with `wrapper`
54
+
55
+ ```
56
+ * */2 * * * /usr/local/rvm/gems/ruby-2.6.5/wrappers/tarbit snapshot
57
+ ```
58
+
59
+ It is recommended to cleanup the statistics folder. You can use a cron job too.
60
+ (It will remove all statistics every 12 hours)
61
+
62
+ ```
63
+ * */12 * * * rm /etc/tarbit/statistics/*.json
64
+ ```
65
+
66
+ Enjoy statistics like these:
67
+
68
+ ![A simple line graph showin connections over time](.assets/1582830001.png)
69
+
70
+
71
+ ## Troubleshooting
72
+
73
+ Native extensions: Imagemagick can not find `MagickWand.h`
74
+
75
+ On Ubuntu, you can run:
76
+ ```
77
+ sudo apt-get install libmagickwand-dev
78
+ ```
79
+
80
+ On Centos, you can run:
81
+ ```
82
+ sudo yum install gcc ImageMagick-devel make which
83
+ ```
84
+
85
+ On Macos, you can run:
86
+
87
+ ```
88
+ brew install imagemagick@6
89
+ brew link --force imagemagick@6
90
+ ```
91
+
92
+ On Windoes, you can install Linux instead.
@@ -23,7 +23,7 @@ module Tarbit
23
23
  Async do |task|
24
24
  endpoint.accept do |peer|
25
25
  stream = Async::IO::Stream.new(peer)
26
- Async.logger.info "New connection: #{stream}"
26
+ Async.logger.info "New connection: #{stream}, #{@connections.size + 1} connections active"
27
27
 
28
28
  id = SecureRandom.uuid
29
29
 
@@ -42,7 +42,7 @@ module Tarbit
42
42
  end
43
43
  rescue StandardError => e
44
44
  @connections = @connections.reject { |stats| stats.fetch(:id) == id }
45
- Async.logger.info "Connection closed: #{stream}"
45
+ Async.logger.info "Connection closed: #{stream}, #{@connections.size} connections active"
46
46
  end
47
47
  end
48
48
  end
@@ -7,8 +7,7 @@ module Tarbit
7
7
 
8
8
  def initialize(server, interval)
9
9
  @server = server
10
- @interval = interval.nil? ? 600 : interval.to_i
11
- @history = []
10
+ @interval = interval.nil? ? 1800 : interval.to_i
12
11
  Async.logger.info "SatisticWatcher - Starting watcher with interval #{@interval}"
13
12
  end
14
13
 
@@ -26,7 +25,7 @@ module Tarbit
26
25
  def create_point_in_time
27
26
  # Add point in time
28
27
  statistic_point = {
29
- created_at: Time.now.to_i,
28
+ created_at: Time.new.strftime("%H:%M"),
30
29
  connections: @server.connections.clone
31
30
  }
32
31
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tarbit
4
- VERSION = "1.0.9"
4
+ VERSION = "1.0.10"
5
5
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.authors = ['Niklas Hanft']
14
14
  s.email = 'hello@niklashanft.com'
15
- s.homepage = 'https://github.com/nhh/apollo'
16
- s.license = 'ISC'
15
+ s.homepage = 'https://github.com/nhh/tarbit'
16
+ s.license = 'MIT'
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.executables << 'tarbit'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklas Hanft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io
@@ -73,9 +73,13 @@ executables:
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".assets/1582830001.png"
77
+ - ".assets/red-wood-cutting_vladimir-kush.jpg"
76
78
  - ".gitignore"
77
79
  - Gemfile
78
80
  - Gemfile.lock
81
+ - LICENSE
82
+ - README.md
79
83
  - bin/tarbit
80
84
  - lib/tarbit.rb
81
85
  - lib/tarbit/server.rb
@@ -83,9 +87,9 @@ files:
83
87
  - lib/tarbit/statistic_watcher.rb
84
88
  - lib/tarbit/version.rb
85
89
  - tarbit.gemspec
86
- homepage: https://github.com/nhh/apollo
90
+ homepage: https://github.com/nhh/tarbit
87
91
  licenses:
88
- - ISC
92
+ - MIT
89
93
  metadata: {}
90
94
  post_install_message:
91
95
  rdoc_options: []