Skip to content

Commit 08f103e

Browse files
authored
Merge pull request #223 from ninp0/master
PWN::Plugins::PWNLogger - add logging verbosity level parameter in #c…
2 parents 0754c34 + ec4b4a5 commit 08f103e

File tree

10 files changed

+103
-132
lines changed

10 files changed

+103
-132
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gem 'aws-sdk', '3.1.0'
1818
gem 'bettercap', '1.6.2'
1919
gem 'brakeman', '5.4.1'
2020
gem 'bson', '4.15.0'
21-
gem 'bundler', '>=2.4.8'
21+
gem 'bundler', '>=2.4.9'
2222
gem 'bundler-audit', '0.9.1'
2323
gem 'bunny', '2.20.3'
2424
gem 'colorize', '0.8.1'
@@ -82,7 +82,7 @@ gem 'sqlite3', '1.6.1'
8282
gem 'thin', '1.8.1'
8383
gem 'tty-prompt', '0.23.1'
8484
gem 'watir', '7.2.2'
85-
gem 'waveform', '0.1.2'
85+
gem 'waveform', '0.1.3'
8686
gem 'webrick', '1.8.1'
8787
gem 'whois', '5.1.0'
8888
gem 'whois-parser', '2.0.0'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ rvm use ruby-ruby-3.2.1@pwn
3737
$ rvm list gemsets
3838
$ gem install --verbose pwn
3939
$ pwn
40-
pwn[v0.4.624]:001 >>> PWN.help
40+
pwn[v0.4.625]:001 >>> PWN.help
4141
```
4242

4343
[![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
@@ -52,7 +52,7 @@ $ rvm use ruby-ruby-3.2.1@pwn
5252
$ gem uninstall --all --executables pwn
5353
$ gem install --verbose pwn
5454
$ pwn
55-
pwn[v0.4.624]:001 >>> PWN.help
55+
pwn[v0.4.625]:001 >>> PWN.help
5656
```
5757

5858

lib/pwn/plugins/http_intercept_helper.rb

Lines changed: 0 additions & 122 deletions
This file was deleted.

lib/pwn/plugins/pwn_logger.rb

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ module PWNLogger
1010
# PWN::Plugins::PWNLogger.create(
1111
# )
1212

13-
public_class_method def self.create
13+
public_class_method def self.create(opts = {})
1414
logger = Logger.new($stdout)
15-
logger.level = Logger::INFO
16-
logger.datetime_format = '%Y-%m-%d %H:%M:%S'
15+
level = opts[:level]
16+
17+
case level.to_s.downcase.to_sym
18+
when :debug
19+
logger.level = Logger::DEBUG
20+
when :error
21+
logger.level = Logger::ERROR
22+
when :fatal
23+
logger.level = Logger::FATAL
24+
when :unknown
25+
logger.level = Logger::UNKNOWN
26+
when :warn
27+
logger.level = Logger::WARN
28+
else
29+
logger.level = Logger::INFO
30+
end
31+
32+
logger.datetime_format = '%Y-%m-%d %H:%M:%S.%N'
1733

1834
logger.formatter = proc do |severity, _datetime, _progname, msg|
1935
# TODO: Include datetime & progname vars
@@ -37,8 +53,10 @@ module PWNLogger
3753

3854
public_class_method def self.help
3955
puts "USAGE:
40-
logger = #{self}.create()
41-
#{self}.authors
56+
logger = #{self}.create(
57+
level: 'optional - logging verbosity :debug|:error|:fatal|:info|:unknown|:warn (Defaults to :info)'
58+
)
59+
#{self}.authors
4260
"
4361
end
4462
end

lib/pwn/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module PWN
4-
VERSION = '0.4.624'
4+
VERSION = '0.4.625'
55
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe PWN::Plugins::AnsibleVault do
6+
it 'should display information for authors' do
7+
authors_response = PWN::Plugins::AnsibleVault
8+
expect(authors_response).to respond_to :authors
9+
end
10+
11+
it 'should display information for existing help method' do
12+
help_response = PWN::Plugins::AnsibleVault
13+
expect(help_response).to respond_to :help
14+
end
15+
end

spec/lib/pwn/plugins/baresip_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe PWN::Plugins::BareSIP do
6+
it 'should display information for authors' do
7+
authors_response = PWN::Plugins::BareSIP
8+
expect(authors_response).to respond_to :authors
9+
end
10+
11+
it 'should display information for existing help method' do
12+
help_response = PWN::Plugins::BareSIP
13+
expect(help_response).to respond_to :help
14+
end
15+
end

spec/lib/pwn/plugins/openai_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe PWN::Plugins::OpenAI do
6+
it 'should display information for authors' do
7+
authors_response = PWN::Plugins::OpenAI
8+
expect(authors_response).to respond_to :authors
9+
end
10+
11+
it 'should display information for existing help method' do
12+
help_response = PWN::Plugins::OpenAI
13+
expect(help_response).to respond_to :help
14+
end
15+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe PWN::Plugins::PWNLogger do
6+
it 'should display information for authors' do
7+
authors_response = PWN::Plugins::PWNLogger
8+
expect(authors_response).to respond_to :authors
9+
end
10+
11+
it 'should display information for existing help method' do
12+
help_response = PWN::Plugins::PWNLogger
13+
expect(help_response).to respond_to :help
14+
end
15+
end

spec/lib/pwn/plugins/voice_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe PWN::Plugins::Voice do
6+
it 'should display information for authors' do
7+
authors_response = PWN::Plugins::Voice
8+
expect(authors_response).to respond_to :authors
9+
end
10+
11+
it 'should display information for existing help method' do
12+
help_response = PWN::Plugins::Voice
13+
expect(help_response).to respond_to :help
14+
end
15+
end

0 commit comments

Comments
 (0)