Hide_Ya_Ips 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25612870db0d563e912bc5b49212f0fdf81754c2ce562c19cf5b0de1a6832399
4
- data.tar.gz: cd72b5cb4c8ecb929c68df050dd3589e9b682114f9121cb2c09e11a6cb9cd0f6
3
+ metadata.gz: 3c29d9e1414c8653e244ca06aa6de5dce8daa5a5a7f44af10e3ef05ca24a79cd
4
+ data.tar.gz: 60d6b8172f0b27e66398b1b5668898ed557b535ae6a3984e8852203578b7d40d
5
5
  SHA512:
6
- metadata.gz: 75c906dc5b900149dcefa7072c36c5f59623078715c53789d6196141dd94c0cf51f5025899663a38f0bd2912ab2ec71ba38885318a55d317d91b4d929c577ed0
7
- data.tar.gz: 5d0521f14aa1722499ad5c42ca245738dc31b28e049c9dfd729807fe1c1c1da7818bab52108704928286fcac1f5623fae9eafbe5fb91fe8ce72a78e8d2687146
6
+ metadata.gz: 3833befb9a8bd2fed22a15b6e0b973e1154af45b0d48795af5da18d699c9f49a55fc349d349c4b73250847c6d9cd8db3998c8b80db3a7c1bcbf33859bb4319f8
7
+ data.tar.gz: a98172878508ff889675887d2d48f6c1de0406a8b4318b4afb723d356a798d883f7a033a5e6254d31424ba1fb28fc938bff673bef6a8f7f961b51a4f2d605c8c
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HideYaIps
2
2
 
3
- TREAT YA SELF by removing your IP from apache web server logs and replace each instance of the IPS with a random generated IP.. Different types of logs will be added at a later time. This gem will take the given IP and go to apache2 logs (/var/log/access.log)... You will need to run as sudo sadly.
3
+ TREAT YA SELF by removing your IP from apache web server logs and replace each instance of the given IP with a random generated IP.. Different types of logs will be added at a later time. This gem will take the given IP and go to apache2 logs (/var/log/access.log)... You will need to run as sudo sadly.
4
4
 
5
5
  ## Installation
6
6
  ```ruby
@@ -15,7 +15,11 @@ hyi = HideYaIps::WebServer.new
15
15
  hyi.ip = "38.99.236.50"
16
16
  hyi.apache
17
17
 
18
+ a = HideYaIps::AuthLog.new
18
19
 
20
+ a.remove_username
21
+
22
+ a.remove_all
19
23
 
20
24
  ```
21
25
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HideYaIps
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/Hide_Ya_Ips.rb CHANGED
@@ -25,4 +25,45 @@ module HideYaIps
25
25
  File.open(@path, 'w+') { |file| file.write(out) }
26
26
  end
27
27
  end
28
+ class AuthLog
29
+ attr_accessor :ip, :user
30
+ def initialize(path: File.join("/var", "log", "auth.log.2"), user: "root")
31
+ @ip = ip
32
+ @user = user
33
+ @user_list = ["user", "admin", "nobody", "proxy", "test", "tom", "frank", "irc", "sshd", "mail"]
34
+ @path = path
35
+ end
36
+ def remove_username
37
+ out = ""
38
+ File.readlines(@path).each do |user|
39
+ new_user = user.match(/#{@user}/)
40
+ if new_user.to_s.eql?(@user)
41
+ out += user.gsub(new_user.to_s, @user_list.sample)
42
+ else
43
+ out += user
44
+ end
45
+ end
46
+ File.delete(@path)
47
+ File.open(@path, 'w+') { |file| file.write(out) }
48
+ end
49
+ def remove_ip
50
+ out = ''
51
+ # generate random IP
52
+ new_ip = Array.new(4) { rand(256) }.join('.')
53
+ File.readlines(@path).each do |line|
54
+ old_ip = line.match(/((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/)
55
+ out += if old_ip.to_s == @ip
56
+ line.gsub(old_ip.to_s, new_ip)
57
+ else
58
+ line
59
+ end
60
+ end
61
+ File.delete(@path)
62
+ File.open(@path, 'w+') { |file| file.write(out) }
63
+ end
64
+ def remove_all
65
+ remove_ip
66
+ remove_username
67
+ end
68
+ end
28
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Hide_Ya_Ips
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael-Meade
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-11-14 00:00:00.000000000 Z
12
+ date: 2025-11-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: TREAT YA SELF By removing your IP from web server logs with a randomly
15
15
  generated IPs