pwn 0.4.584 → 0.4.585

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: 19ef4baab5a1450de0598985ed9d744d06e78865fa6203ed0bbd36d125ef9228
4
- data.tar.gz: ffc3a80466da20a458803846154daa0a55c44e6e8e585f7481a53ffe3d26c105
3
+ metadata.gz: b544200c367ae8482617151dc6d4f4448489713e9aae3377aec3b9f70d149cf0
4
+ data.tar.gz: d5298d12a15d8c791a910c6010943a2ca67071b59fbe97fbf238948996f89abc
5
5
  SHA512:
6
- metadata.gz: '04693f0a5ed8f20a8cc8129d01c318ab0eb18a712028fe72193fef03cef664e177c410189b60ba6e828e71f942381a6f53eac1fa36acff6487277cb756979630'
7
- data.tar.gz: 44e299d4c17ba886a27498771b16ae2c7efc27404f97e5fefff0ec3d7832dd2121625c0aca452872379ccfde3ab25de3984f72e183776e8893e130ef019c88d4
6
+ metadata.gz: 1ba49576c14cd2f10599f15890be9f044ce83ca435dfc9130bfb9c12ccbc94b8e03ad10232dcd9cb776c00e6903bb678f3eb23ebcb6146fa0d0de2ff598ee0b1
7
+ data.tar.gz: 0f27f859b6342d23efa84e07917477a28b2732f1ec8adb75ee8b205940a8be908bc8936b2018dd2e9f86277258acbfe9602490653853fc754c5f243077897a69
data/Gemfile CHANGED
@@ -18,7 +18,7 @@ gem 'aws-sdk', '3.1.0'
18
18
  gem 'bettercap', '1.6.2'
19
19
  gem 'brakeman', '5.4.0'
20
20
  gem 'bson', '4.15.0'
21
- gem 'bundler', '>=2.4.1'
21
+ gem 'bundler', '>=2.4.2'
22
22
  gem 'bundler-audit', '0.9.1'
23
23
  gem 'bunny', '2.20.1'
24
24
  gem 'colorize', '0.8.1'
@@ -60,7 +60,7 @@ gem 'rex', '2.0.13'
60
60
  gem 'rmagick', '5.1.0'
61
61
  gem 'rspec', '3.12.0'
62
62
  gem 'rtesseract', '3.1.2'
63
- gem 'rubocop', '1.41.1'
63
+ gem 'rubocop', '1.42.0'
64
64
  gem 'rubocop-rake', '0.6.0'
65
65
  gem 'rubocop-rspec', '2.16.0'
66
66
  gem 'ruby-audio', '1.6.1'
@@ -77,7 +77,7 @@ gem 'spreadsheet', '1.3.0'
77
77
  gem 'sqlite3', '1.5.4'
78
78
  gem 'thin', '1.8.1'
79
79
  gem 'tty-prompt', '0.23.1'
80
- gem 'watir', '7.2.0'
80
+ gem 'watir', '7.2.1'
81
81
  gem 'waveform', '0.1.2'
82
82
  gem 'webrick', '1.7.0'
83
83
  gem 'whois', '5.1.0'
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.3@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.584]:001 >>> PWN.help
40
+ pwn[v0.4.585]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![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-3.1.3@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.584]:001 >>> PWN.help
55
+ pwn[v0.4.585]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module PWN
6
+ module Plugins
7
+ # This plugin is used for interacting w/ ChatSonic's REST API using
8
+ # the 'rest' browser type of PWN::Plugins::TransparentBrowser.
9
+ # This is based on the following ChatSonic API Specification:
10
+ # https://docs.writesonic.com/reference/chatsonic_v2businesscontentchatsonic_post-1
11
+ module ChatSonic
12
+ @@logger = PWN::Plugins::PWNLogger.create
13
+
14
+ # Supported Method Parameters::
15
+ # chat_sonic_rest_call(
16
+ # apu_key: 'required - chat_sonic api_key',
17
+ # http_method: 'optional HTTP method (defaults to GET)
18
+ # rest_call: 'required rest call to make per the schema',
19
+ # params: 'optional params passed in the URI or HTTP Headers',
20
+ # http_body: 'optional HTTP body sent in HTTP methods that support it e.g. POST'
21
+ # )
22
+
23
+ private_class_method def self.chat_sonic_rest_call(opts = {})
24
+ http_method = if opts[:http_method].nil?
25
+ :get
26
+ else
27
+ opts[:http_method].to_s.scrub.to_sym
28
+ end
29
+ rest_call = opts[:rest_call].to_s.scrub
30
+ params = opts[:params]
31
+ http_body = opts[:http_body].to_s.scrub
32
+ base_chat_sonic_api_uri = 'https://api.writesonic.com/v2/business/content'
33
+ api_key = opts[:api_key]
34
+
35
+ rest_client = PWN::Plugins::TransparentBrowser.open(browser_type: :rest)::Request
36
+
37
+ case http_method
38
+ when :get
39
+ response = rest_client.execute(
40
+ method: :get,
41
+ url: "#{base_chat_sonic_api_uri}/#{rest_call}",
42
+ headers: {
43
+ accept: 'application/json',
44
+ content_type: 'application/json; charset=UTF-8',
45
+ x_api_key: api_key,
46
+ params: params
47
+ },
48
+ verify_ssl: false
49
+ )
50
+
51
+ when :post
52
+ response = rest_client.execute(
53
+ method: :post,
54
+ url: "#{base_chat_sonic_api_uri}/#{rest_call}",
55
+ headers: {
56
+ accept: 'application/json',
57
+ content_type: 'application/json; charset=UTF-8',
58
+ x_api_key: api_key,
59
+ params: params
60
+ },
61
+ payload: http_body,
62
+ verify_ssl: false
63
+ )
64
+
65
+ else
66
+ raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
67
+ end
68
+ response
69
+ rescue StandardError => e
70
+ case e.message
71
+ when '400 Bad Request', '404 Resource Not Found'
72
+ "#{e.message}: #{e.response}"
73
+ else
74
+ raise e
75
+ end
76
+ end
77
+
78
+ # Supported Method Parameters::
79
+ # response = PWN::Plugins::ChatSonic.chat(
80
+ # api_key: 'required - ChatSonic API Key',
81
+ # input_text: 'required - message to ChatSonic'
82
+ # enable_google_results: 'optional - use Google to answer (default to true)',
83
+ # enable_memory: 'optional - try to continue previous conversation (default to false)',
84
+ # )
85
+
86
+ public_class_method def self.chat(opts = {})
87
+ api_key = opts[:api_key]
88
+ input_text = opts[:input_text]
89
+
90
+ enable_google_results = opts[:enable_google_results]
91
+ enable_google_results ||= true
92
+
93
+ enable_memory = opts[:enable_memory]
94
+ enable_memory ||= false
95
+
96
+ params = opts[:params]
97
+ params ||= {}
98
+
99
+ rest_call = 'chatsonic'
100
+
101
+ params[:engine] = 'premium'
102
+
103
+ http_body = {
104
+ enable_google_results: enable_google_results,
105
+ enable_memory: enable_memory,
106
+ input_text: input_text
107
+ }
108
+
109
+ response = chat_sonic_rest_call(
110
+ http_method: :post,
111
+ api_key: api_key,
112
+ rest_call: rest_call,
113
+ params: params,
114
+ http_body: http_body.to_json
115
+ )
116
+
117
+ JSON.parse(response, symbolize_names: true)
118
+ rescue StandardError => e
119
+ raise e
120
+ end
121
+
122
+ # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
123
+
124
+ public_class_method def self.authors
125
+ "AUTHOR(S):
126
+ 0day Inc. <request.pentest@0dayinc.com>
127
+ "
128
+ end
129
+
130
+ # Display Usage for this Module
131
+
132
+ public_class_method def self.help
133
+ puts "USAGE:
134
+ response = #{self}.chat(
135
+ api_key: 'required - ChatSonic API Key',
136
+ input_text: 'required - message to ChatSonic'
137
+ enable_google_results: 'optional - use Google to answer (default to true)',
138
+ enable_memory: 'optional - try to continue previous conversation (default to false)',
139
+ )
140
+
141
+ #{self}.authors
142
+ "
143
+ end
144
+ end
145
+ end
146
+ end
data/lib/pwn/plugins.rb CHANGED
@@ -14,6 +14,7 @@ module PWN
14
14
  autoload :BurpSuite, 'pwn/plugins/burp_suite'
15
15
  autoload :BusPirate, 'pwn/plugins/bus_pirate'
16
16
  autoload :Char, 'pwn/plugins/char'
17
+ autoload :ChatSonic, 'pwn/plugins/chat_sonic'
17
18
  autoload :CreditCard, 'pwn/plugins/credit_card'
18
19
  autoload :PWNLogger, 'pwn/plugins/pwn_logger'
19
20
  autoload :DAOLDAP, 'pwn/plugins/dao_ldap'
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.4.584'
4
+ VERSION = '0.4.585'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.584
4
+ version: 0.4.585
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2023-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 2.4.1
117
+ version: 2.4.2
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 2.4.1
124
+ version: 2.4.2
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler-audit
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -688,14 +688,14 @@ dependencies:
688
688
  requirements:
689
689
  - - '='
690
690
  - !ruby/object:Gem::Version
691
- version: 1.41.1
691
+ version: 1.42.0
692
692
  type: :runtime
693
693
  prerelease: false
694
694
  version_requirements: !ruby/object:Gem::Requirement
695
695
  requirements:
696
696
  - - '='
697
697
  - !ruby/object:Gem::Version
698
- version: 1.41.1
698
+ version: 1.42.0
699
699
  - !ruby/object:Gem::Dependency
700
700
  name: rubocop-rake
701
701
  requirement: !ruby/object:Gem::Requirement
@@ -926,14 +926,14 @@ dependencies:
926
926
  requirements:
927
927
  - - '='
928
928
  - !ruby/object:Gem::Version
929
- version: 7.2.0
929
+ version: 7.2.1
930
930
  type: :runtime
931
931
  prerelease: false
932
932
  version_requirements: !ruby/object:Gem::Requirement
933
933
  requirements:
934
934
  - - '='
935
935
  - !ruby/object:Gem::Version
936
- version: 7.2.0
936
+ version: 7.2.1
937
937
  - !ruby/object:Gem::Dependency
938
938
  name: waveform
939
939
  requirement: !ruby/object:Gem::Requirement
@@ -1566,6 +1566,7 @@ files:
1566
1566
  - lib/pwn/plugins/burp_suite.rb
1567
1567
  - lib/pwn/plugins/bus_pirate.rb
1568
1568
  - lib/pwn/plugins/char.rb
1569
+ - lib/pwn/plugins/chat_sonic.rb
1569
1570
  - lib/pwn/plugins/credit_card.rb
1570
1571
  - lib/pwn/plugins/dao_ldap.rb
1571
1572
  - lib/pwn/plugins/dao_mongo.rb