security-gem 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1887b65fa1934d3aaff48ec967805dd0f6221e569ef8155934b872905026806f
4
+ data.tar.gz: 8b736cf6c8820ff58e56cf5d4d942ae863e10ff021e5fa0283b253018ae95da1
5
+ SHA512:
6
+ metadata.gz: 0cf8a70652fe3c7d26e0a91956392aaf30a8627e2155e36f4719bd2bbaff7d80bb73512d258360d54552f12dfc2fecd007e717d0af1f828df7dd84163cb3f728
7
+ data.tar.gz: bb9408d41e321fd8027e1f124d4a154bfb5cf80fda06c91b3ccdbf2eab0967c5de2cc9835525333b603bbe48bcdb08513c1d5c5381eccaff6f5626d23c06e1b9
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Style/StringLiterals:
2
+ Enabled: true
3
+ EnforcedStyle: double_quotes
4
+
5
+ Style/StringLiteralsInInterpolation:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Layout/LineLength:
10
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in security-gem.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rubocop", "~> 0.80"
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ security-gem (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ parallel (1.22.1)
11
+ parser (3.1.2.0)
12
+ ast (~> 2.4.1)
13
+ rainbow (3.1.1)
14
+ rake (13.0.6)
15
+ regexp_parser (2.4.0)
16
+ rexml (3.2.5)
17
+ rubocop (0.93.1)
18
+ parallel (~> 1.10)
19
+ parser (>= 2.7.1.5)
20
+ rainbow (>= 2.2.2, < 4.0)
21
+ regexp_parser (>= 1.8)
22
+ rexml
23
+ rubocop-ast (>= 0.6.0)
24
+ ruby-progressbar (~> 1.7)
25
+ unicode-display_width (>= 1.4.0, < 2.0)
26
+ rubocop-ast (1.17.0)
27
+ parser (>= 3.1.1.0)
28
+ ruby-progressbar (1.11.0)
29
+ unicode-display_width (1.8.0)
30
+
31
+ PLATFORMS
32
+ x86_64-darwin-20
33
+
34
+ DEPENDENCIES
35
+ rake (~> 13.0)
36
+ rubocop (~> 0.80)
37
+ security-gem!
38
+
39
+ BUNDLED WITH
40
+ 2.2.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 tuckerweibell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Security::Gem
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/security/gem`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'security-gem'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install security-gem
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/security-gem.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "security/gem"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/file.json ADDED
@@ -0,0 +1,2 @@
1
+ # Logfile created on 2022-05-09 14:30:48 -0600 by logger.rb/v1.4.3
2
+ {"level":"WARN","timestamp":"2022-05-09 14:30:48 -0600","app":null,"message":"\"{injection:SELECT -1 OR admin;, ip_address:192.168.1.113}\""}
@@ -0,0 +1,39 @@
1
+ require 'json'
2
+ require 'logger'
3
+ require 'logger/formatter'
4
+ require 'open-uri'
5
+
6
+
7
+ module SecurityLogger
8
+
9
+ #Create logs used for SQL Injection detections
10
+ class Sql_Injection
11
+ def initialize
12
+
13
+ end
14
+
15
+ def log(input)
16
+ logger = Logger.new(STDOUT)
17
+ logger.formatter = proc do |severity, datetime, progname, msg|
18
+ {
19
+ severity: severity,
20
+ timestamp: datetime.to_s,
21
+ app: progname,
22
+ message: msg
23
+ }.to_json + $/
24
+ end
25
+
26
+ error = {:input => input}
27
+ logger.warn(JSON.parse(error.to_json))
28
+ end
29
+
30
+ def check_input(input)
31
+ File.foreach('payloads.txt') do |file|
32
+ if file.strip == input.strip
33
+ self.log(input.strip)
34
+ break
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Security
4
+ module Gem
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "gem/version"
4
+ require_relative "gem/builder"
5
+ require 'socket'
6
+
7
+ module Security
8
+ module Gem
9
+ class Error < StandardError; end
10
+ end
11
+ end
12
+
13
+ input = "delete"
14
+
15
+ SecurityLogger::Sql_Injection.new().check_input(input)
16
+