rex-random_identifier 0.1.15 → 0.1.18

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: fb07b709a8731f3de8bfc0415fb123f7ed415a81c197fd563b92cf5653a5b48f
4
- data.tar.gz: 548c78b01c445d123dfa5c9b87f48ec859b2262fb0f09b6b736a9fedd616ee4d
3
+ metadata.gz: 615a0a02f3a8f12d617828ee1875a52c6aee60d81ce8a22268ee0dd405846eec
4
+ data.tar.gz: 55279a15cd3270f734fa402795581021a272492fd46e24234a9932448d139154
5
5
  SHA512:
6
- metadata.gz: c34bd0299242fb0afaf0e4ef8580e5c40f07f350cffac62e2042d389c299ed10eb76fb0004ef78621c046b510ebed536d9c2552d5f28c0dcecd19b5d73743343
7
- data.tar.gz: ea324d638a0e70e5d8b8c0c42b46607120d275ed7c9923c114fda9717f76b53b702a5a44b8fdbcb4f2f24e7314328e7f73cbf33f7efb4eec82aa57127a07284e
6
+ metadata.gz: a2984829ed7d831d0322bf3680d1b96f0428604f66b25c4170e99d9ae87000c898bfa022c2f7478afa7364351c664c1019748a9293625b46bae7300fa3a99609
7
+ data.tar.gz: fc10df6eaa64992e75dab3c55cb8353545d7c57c56a316b37b0abdd9216c95e8c47729ad6900a7b39953c27358242f4dbb73e8c10e0f9615de21d176937da53f
@@ -9,44 +9,5 @@ on:
9
9
  - '*'
10
10
 
11
11
  jobs:
12
- test:
13
- runs-on: ${{ matrix.os }}
14
- timeout-minutes: 40
15
-
16
- strategy:
17
- fail-fast: true
18
- matrix:
19
- ruby:
20
- - '2.7'
21
- - '3.0'
22
- - '3.1'
23
- - '3.2'
24
- os:
25
- - ubuntu-20.04
26
- - ubuntu-latest
27
- exclude:
28
- - { os: ubuntu-latest, ruby: '2.7' }
29
- - { os: ubuntu-latest, ruby: '3.0' }
30
- test_cmd:
31
- - bundle exec rspec
32
-
33
- env:
34
- RAILS_ENV: test
35
-
36
- name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }} - ${{ matrix.test_cmd }}
37
- steps:
38
- - name: Checkout code
39
- uses: actions/checkout@v4
40
-
41
- - name: Setup Ruby
42
- uses: ruby/setup-ruby@v1
43
- with:
44
- ruby-version: ${{ matrix.ruby }}
45
- bundler-cache: true
46
-
47
- - name: ${{ matrix.test_cmd }}
48
- run: |
49
- echo "${CMD}"
50
- bash -c "${CMD}"
51
- env:
52
- CMD: ${{ matrix.test_cmd }}
12
+ build:
13
+ uses: rapid7/metasploit-framework/.github/workflows/shared_gem_verify.yml@master
@@ -34,7 +34,8 @@ class Rex::RandomIdentifier::Generator
34
34
  # This should be pretty universal for identifier rules
35
35
  :char_set => Rex::Text::AlphaNumeric+"_",
36
36
  :first_char_set => Rex::Text::LowerAlpha,
37
- :forbidden => [].freeze
37
+ :forbidden => [].freeze,
38
+ :prefix => ''
38
39
  }
39
40
 
40
41
  JavaOpts = DefaultOpts.merge(
@@ -111,12 +112,164 @@ class Rex::RandomIdentifier::Generator
111
112
  ).freeze
112
113
  )
113
114
 
115
+ PHPOpts = DefaultOpts.merge(
116
+ prefix: '$',
117
+ first_char_set: Rex::Text::Alpha + '_',
118
+ # see: https://www.php.net/manual/en/reserved.php
119
+ # see: https://www.php.net/manual/en/reserved.variables.php
120
+ forbidden: (
121
+ %w[
122
+ $GLOBALS $_SERVER $_GET $_POST $_FILES $_REQUEST $_SESSION $_ENV $_COOKIE
123
+ $HTTP_GET_VARS $HTTP_POST_VARS $HTTP_COOKIE_VARS $HTTP_SERVER_VARS
124
+ $HTTP_ENV_VARS $HTTP_SESSION_VARS $HTTP_POST_FILES $HTTP_RAW_POST_DATA
125
+ $php_errormsg $http_response_header $argc $argv $this
126
+ ]
127
+ )
128
+ )
129
+
130
+ PowershellOpts = DefaultOpts.merge(
131
+ forbidden: (
132
+ # PowerShell reserved words and language keywords
133
+ # https://docs.microsoft.com/en-us/powershell/scripting/lang-spec/chapter-02
134
+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_reserved_words
135
+ %w[
136
+ assembly base begin break catch class command configuration continue data define do dynamicparam else elseif
137
+ end enum exit filter finally for foreach from function hidden if in inlinescript interface module namespace
138
+ parallel param private process public return sequence static switch throw trap try type until using var while
139
+ workflow bool byte char decimal double float int long object sbyte short string uint ulong ushort
140
+ ] +
141
+ # Common .NET type names used in PowerShell
142
+ # https://learn.microsoft.com/en-us/dotnet/api/system#classes
143
+ %w[
144
+ accessviolationexception activator aggregateexception appcontext appdomain appdomainsetup appdomainunloadedexception
145
+ applicationexception applicationid argumentexception argumentnullexception argumentoutofrangeexception
146
+ arithmeticexception array arraytypemismatchexception assemblyloadeventargs attribute attributeusageattribute
147
+ badimageformatexception bitconverter buffer cannotunloadappdomainexception charenumerator clscompliantattribute
148
+ console consolecanceleventargs contextboundobject contextmarshalexception contextstaticattribute convert
149
+ datamisalignedexception dbnull delegate dividebyzeroexception dllnotfoundexception duplicatewaitobjectexception
150
+ entrypointnotfoundexception enum environment eventargs exception executionengineexception fieldaccessexception
151
+ filestyleuriparser flagsattribute formatexception formattablestring ftpstyleuriparser gc genericheruriparser
152
+ gopherstyleuriparser httpstyleuriparser indexoutofrangeexception insufficientexecutionstackexception
153
+ insufficientmemoryexception invalidcastexception invalidoperationexception invalidprogramexception
154
+ invalidtimezoneexception lazy ldapstyleuriparser loaderoptimizationattribute localdatastoreslot
155
+ marshalbyrefobject math mathf memberaccessexception memoryextensions methodaccessexception missingfieldexception
156
+ missingmemberexception missingmethodexception mtathreadattribute multicastdelegate multicastnotsupportedexception
157
+ netpipestyleuriparser nettcpstyleuriparser newsstyleuriparser nonserializedattribute notfinitenumberexception
158
+ notimplementedexception notsupportedexception nullable nullreferenceexception object objectdisposedexception
159
+ obsoleteattribute operatingsystem operationcanceledexception outofmemoryexception overflowexception
160
+ paramarrayattribute platformnotsupportedexception progress random rankexception resolveeventargs
161
+ serializableattribute stackoverflowexception stathreadattribute string stringcomparer stringnormalizationextensions
162
+ systemexception threadstaticattribute timeoutexception timeprovider timezone timezoneinfo
163
+ timezonenotfoundexception tuple tupleextensions type typeaccessexception typeinitializationexception
164
+ typeloadexception typeunloadedexception unauthorizedaccessexception unhandledexceptioneventargs uri uribuilder
165
+ uriformatexception uriparser uritypeconverter valuetype version weakreference
166
+ array datetime hashtable psobject scriptblock timespan void xml
167
+ ] +
168
+ # Common .NET struct types used in PowerShell
169
+ # https://learn.microsoft.com/en-us/dotnet/api/system#structs
170
+ %w[
171
+ argiterator boolean byte char consolekey consolekeyinfo datetime datetimeoffset dayofweek decimal double
172
+ guid int16 int32 int64 intptr memory nullable range rune runtime sbyte single timeonly timespan
173
+ typedreference uint16 uint32 uint64 uintptr valuetuple void arithmeticexception argumentexception
174
+ argumentnullexception argumentoutofrangeexception badimageformatexception cannotunloadappdomainexception
175
+ contextmarshalexception datamisalignedexception dividebyzeroexception dllnotfoundexception
176
+ duplicatewaitobjectexception entrypointnotfoundexception executionengineexception fieldaccessexception
177
+ formatexception indexoutofrangeexception insufficientexecutionstackexception insufficientmemoryexception
178
+ invalidcastexception invalidoperationexception invalidprogramexception invalidtimezoneexception
179
+ memberaccessexception methodaccessexception missingfieldexception missingmemberexception
180
+ missingmethodexception multicastnotsupportedexception notfinitenumberexception notimplementedexception
181
+ notsupportedexception nullreferenceexception objectdisposedexception operationcanceledexception
182
+ outofmemoryexception overflowexception platformnotsupportedexception rankexception stackoverflowexception
183
+ systemexception timeoutexception typeaccessexception typeinitializationexception typeloadexception
184
+ typeunloadedexception unauthorizedaccessexception
185
+ ] +
186
+ # Common .NET interface types used in PowerShell
187
+ # https://learn.microsoft.com/en-us/dotnet/api/system#interfaces
188
+ %w[
189
+ iasyncresult icloneable icomparable icomparer iconvertible icustomformatter idisposable iequalitycomparer
190
+ iformattable iformatprovider iserviceprovider ienumerable ienumerator icollection ilist idictionary
191
+ ireadonlycollection ireadonlylist ireadonlydictionary iset iproducerconsumercollection
192
+ iconcurrentcollection inotifypropertychanged inotifycollectionchanged iobserver iobservable
193
+ ituple istructuralcomparable istructuralequatable ispanformattable ibinaryinteger ibinaryfloatingpoint
194
+ ibitwiseoperators icomparisonoperators iequalityoperators iincrementoperators iminmaxvalue
195
+ inumberbase iadditionoperators isubtractionoperators imultiplicationoperators idivisionoperators
196
+ imodaoperators ishiftoperators iunaryoperators iparsable ispanparsable iformatable
197
+ ] +
198
+ # Common .NET enum types used in PowerShell
199
+ # https://learn.microsoft.com/en-us/dotnet/api/system#enums
200
+ %w[
201
+ attributetargets base64formattingoptions consolecolor datetimekind dayofweek environmentspecialfolder
202
+ environmentvariabletarget gctype gcgeneration genotificationstatus globalizationmode
203
+ loaderoption midsreamstarttype normalizedform operatingsystem platformid processorarchitecture
204
+ stringcomparison stringsplitopions typecode urikind uricomponents urihostnametype uriformat
205
+ comparetoptions culturedupinfallbackstyles datetimestyles numberstyles runtimeidentifiertype
206
+ securityruleset targetframeworkmoniker timezonefindtype unmanagedfunctionpointercallingconvention
207
+ fileattributes fileaccess filemode fileshare fileaction filetype searchoption directoryoption
208
+ consolecanceltype consolespecialkey consolemodifiers
209
+ ] +
210
+ # Common .NET delegate types used in PowerShell
211
+ # https://learn.microsoft.com/en-us/dotnet/api/system#delegates
212
+ %w[
213
+ action func predicate comparison converter eventhandler asynccallback crossapplicationstringproc
214
+ waitortimercallback timerproc unhandledexceptioneventhandler assemblybindingprovider resolvehandler
215
+ convolecallback appdomainunloadhandler assemblyhandler modulehandler contexthandler
216
+ loadeventhandler unloadeventhandler begininvokedelegate endinvokedelegate asyncresultdelegate
217
+ predefineddelegate delegateserial multidelgate singletondelegate
218
+ ] +
219
+ # PowerShell variable scope keywords
220
+ # https://docs.microsoft.com/en-us/powershell/scripting/lang-spec/chapter-02
221
+ %w[
222
+ global local private script using workflow
223
+ ] +
224
+ # PowerShell automatic variables
225
+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables
226
+ %w[
227
+ args consolefilename error executioncontext false home host input lastexitcode matches myinvocation nestedpromptlevel
228
+ null pid profile pscmdlet pscommandpath pshome psscriptroot psversiontable pwd shellid stacktrace true
229
+ ] +
230
+ # PowerShell preference variables
231
+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables
232
+ %w[
233
+ confirmpreference debugpreference erroractionpreference errorview formatenumerationlimit informationpreference
234
+ logcommandhealthevent logcommandlifecycleevent lopenginehealthevent logenginelifecycleevent logproviderhealthevent
235
+ logproviderlifecycleevent maximumhistorycount ofs outputencoding progresspreference psdefaultparametervalues
236
+ psemailserver psmoduleautoloadingpreference psnativecommandargumentpassing psnativecommanduseerroractionpreference
237
+ pssessionapplicationname pssessionconfigurationname pssessionoption psstyle transcript verbosepreference
238
+ specsapreference whatifpreference
239
+ ] +
240
+ # Common PowerShell cmdlets that should be avoided as identifiers
241
+ # https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands
242
+ %w[
243
+ add clear copy export find format get import invoke join move new out read remove rename select set sort
244
+ split start stop test where write compare group measure tee convertfrom convertto foreach object sort unique
245
+ first last skip skipuntil takewhile
246
+ ] +
247
+ # Common PowerShell cmdlet aliases and shortnames
248
+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_aliases
249
+ %w[
250
+ cat cd chdir clc clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cwmi dbp del diff dir echo epal epcsv
251
+ fc fhx fl foreach ft fw gal gbp gc gci gcm gcs gdr ghy gi gjb gl gm gmo gp gps gpv group gsn gsnp gsv gtz gu gv
252
+ gwmi h history icm iex ihy ii ipal ipcsv irm ise iwmi iwr kill lp ls man md measure mi mount move mp mv nal ndr
253
+ ni nmo npssc nsn nv ogv oh popd pushd pwd r rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rv
254
+ rvpa rwmi sajb sal saps sasv sbp sc scb select set shcm si sl sleep sls sort sp spjb spps spsv start sv swmi
255
+ tee type wget where wjb write
256
+ ] +
257
+ # PowerShell operators (word-based)
258
+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators
259
+ %w[
260
+ and band bnot bor bxor not or xor eq ne gt ge lt le like notlike match notmatch contains notcontains in notin
261
+ replace split join is isnot as
262
+ ]
263
+ ).uniq.freeze
264
+ )
265
+
114
266
  Opts = {
115
267
  default: DefaultOpts,
116
268
  java: JavaOpts,
117
269
  jsp: JSPOpts,
118
270
  javascript: JavaScriptOpts,
119
- python: PythonOpts
271
+ python: PythonOpts,
272
+ powershell: PowershellOpts
120
273
  }
121
274
 
122
275
  # @param opts [Hash] Options, see {DefaultOpts} for default values
@@ -247,12 +400,14 @@ class Rex::RandomIdentifier::Generator
247
400
  # pick a random length within the limits
248
401
  len ||= rand(@opts[:min_length] .. (@opts[:max_length]))
249
402
 
250
- ident = ""
403
+ ident = ''
251
404
 
252
405
  # XXX: Infinite loop if block returns only values we've already
253
406
  # generated.
254
407
  loop do
255
- ident = Rex::Text.rand_base(1, "", @opts[:first_char_set])
408
+ ident = +''
409
+ ident << @opts[:prefix]
410
+ ident << Rex::Text.rand_base(1, "", @opts[:first_char_set])
256
411
  ident << Rex::Text.rand_base(len-1, "", @opts[:char_set])
257
412
  if block_given?
258
413
  ident = yield ident
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module RandomIdentifier
3
- VERSION = "0.1.15"
3
+ VERSION = "0.1.18"
4
4
  end
5
5
  end
@@ -23,4 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rspec"
24
24
 
25
25
  spec.add_runtime_dependency "rex-text"
26
+
27
+ # bigdecimal is not part of the default gems starting from Ruby 3.4.0: https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/
28
+ spec.add_runtime_dependency 'bigdecimal'
26
29
  end
metadata CHANGED
@@ -1,40 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rex-random_identifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIERDCCAqygAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBttc2Zk
14
- ZXYvREM9bWV0YXNwbG9pdC9EQz1jb20wHhcNMjMxMDMwMTYwNDI1WhcNMjUxMDI5
15
- MTYwNDI1WjAmMSQwIgYDVQQDDBttc2ZkZXYvREM9bWV0YXNwbG9pdC9EQz1jb20w
16
- ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDZN/EKv+yVjwiKWvjAVhjF
17
- aWNYI0E9bJ5d1qKd29omRYX9a+OOKBCu5+394fyF5RjwU4mYGr2iopX9ixRJrWXH
18
- ojs70tEvV1CmvP9rhz7JKzQQoJOkinrz4d+StIylxVxVdgm7DeiB3ruTwvl7qKUv
19
- piWzhrBFiVU6XIEAwq6wNEmnv2D+Omyf4h0Tf99hc6G0QmBnU3XydqvnZ+AzUbBV
20
- 24RH3+NQoigLbvK4M5aOeYhk19di58hznebOw6twHzNczshrBeMFQp985ScNgsvF
21
- rL+7HNNwpcpngERwZfzDNn7iYN5X3cyvTcykShtsuPMa5zXsYo42LZrsTF87DW38
22
- D8sxL6Dgdqu25Mltdw9m+iD4rHSfb1KJYEoNO+WwBJLO2Y4d6G1CR66tVeWsZspb
23
- zneOVC+sDuil7hOm+6a7Y2yrrRyT6IfL/07DywjPAIRUp5+Jn8ZrkWRNo2AOwWBG
24
- k5gz7SfJPHuyVnPlxoMA0MTFCUnnnbyHu882TGoJGgMCAwEAAaN9MHswCQYDVR0T
25
- BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFIQfNa4E889ZE334cwU7eNu2hScH
26
- MCAGA1UdEQQZMBeBFW1zZmRldkBtZXRhc3Bsb2l0LmNvbTAgBgNVHRIEGTAXgRVt
27
- c2ZkZXZAbWV0YXNwbG9pdC5jb20wDQYJKoZIhvcNAQELBQADggGBAMfzvKcV27p7
28
- pctmpW2JmIXLMrjNLyGJAxELH/t9pJueXdga7uj2fJkYQDbwGw5x4MGyFqhqJLH4
29
- l/qsUF3PyAXDTSWLVaqXQVWO+IIHxecG0XjPXTNudzMU0hzqbqiBKvsW7/a3V5BP
30
- SWlFzrFkoXWlPouFpoakyYMJjpW4SGdPzRv7pM4OhXtkXpHiRvx5985FrHgHlI89
31
- NSIuIUbp8zqk4hP1i9MV0Lc/vTf2gOmo+RHnjqG1NiYfMCYyY/Mcd4W36kGOl468
32
- I8VDTwgCufkAzFu7BJ5yCOueqtDcuq+d3YhAyU7NI4+Ja8EwazOnB+07sWhKpg7z
33
- yuQ1mWYPmZfVQpoSVv1CvXsoqJYXVPBBLOacKKSj8ArVG6pPn9Bej7IOQdblaFjl
34
- DgscAao7wB3xW2BWEp1KnaDWkf1x9ttgoBEYyuYwU7uatB67kBQG1PKvLt79wHvz
35
- Dxs+KOjGbBRfMnPgVGYkORKVrZIwlaboHbDKxcVW5xv+oZc7KYXWGg==
36
- -----END CERTIFICATE-----
37
- date: 2025-02-13 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2025-08-01 00:00:00.000000000 Z
38
12
  dependencies:
39
13
  - !ruby/object:Gem::Dependency
40
14
  name: rake
@@ -78,6 +52,20 @@ dependencies:
78
52
  - - ">="
79
53
  - !ruby/object:Gem::Version
80
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bigdecimal
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
81
69
  description: Ruby Exploitation(Rex) library for generating Random identifier strings
82
70
  email:
83
71
  - msfdev@metasploit.com
@@ -102,7 +90,7 @@ files:
102
90
  homepage: https://github.com/rapid7/rex-random_identifier
103
91
  licenses: []
104
92
  metadata: {}
105
- post_install_message:
93
+ post_install_message:
106
94
  rdoc_options: []
107
95
  require_paths:
108
96
  - lib
@@ -117,8 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
105
  - !ruby/object:Gem::Version
118
106
  version: '0'
119
107
  requirements: []
120
- rubygems_version: 3.3.3
121
- signing_key:
108
+ rubygems_version: 3.4.19
109
+ signing_key:
122
110
  specification_version: 4
123
111
  summary: Random Identifier Generator
124
112
  test_files: []
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file