scopes_extractor 0.3.0 → 0.5.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: 9213285da286cb2ad488374dc8e5971d34bb06987b710c2bbd4dcac12f3d1384
4
- data.tar.gz: af84cd2c4e8e8a43ccb40f126bc1996e812bf66b828e2a3b4aea6bd5dcba9531
3
+ metadata.gz: f4d182543a95c5350e15e48ac31e9294144bbfac8b8ab7b46c2fe473e0e29853
4
+ data.tar.gz: a7b9dd659a243d2c9714a807824d11631040ee4e199756b79d99f5dbf5f5c7e5
5
5
  SHA512:
6
- metadata.gz: 20bbb233618c27774be21ab80ac56e8e9ac2b6e749922bdb1768c634b30f7b7b04f23e622f0a958ddc257e6ed5ef1239fb94aec973eafbfe0c20c3300c831d60
7
- data.tar.gz: 5612a5f74b44fd9904e0f7b3ba22218104ee68e36ca27b15dbcaf8f437e22e74f680f997a832d64ddf0580f4f0d8421baac3532aee8537a8c587f48c45bf7369
6
+ metadata.gz: 3b7dce096f56b17a31ad146b8f2b6b0c0f11643fa703f77410b4b0f1de2cf2ef9dc0557849144e9abef3628216032a909d5d65bb5d385a2a382d9eb6c718c5b6
7
+ data.tar.gz: 44c364cd7de7a23903e380dc1d6d367a55ac81143054bae1688b0eaf2de80efb0d59bcf5464fdbdf223c298ab24821f65ceedb11cb26fbfbd8a0f2e69e5b4e84
@@ -27,12 +27,18 @@ class Intigriti
27
27
  scopes_normalized = []
28
28
 
29
29
  scopes.each do |scope|
30
- next unless scope['type'] == 1 # 1 == Web Application
31
-
32
- endpoint = normalize(scope['endpoint'])
33
- next if exclusions.any? { |exclusion| endpoint.include?(exclusion) } || !endpoint.include?('.')
34
-
35
- scopes_normalized << endpoint
30
+ next unless scope['type'] == 1 || scope['type'] == 6 # 1 == Web Application || 6 == Other
31
+
32
+ if scope['type'] == 1 # Web Application
33
+ endpoint = normalize(scope['endpoint'])
34
+ scopes_normalized << endpoint unless exclusions.any? { |exclusion| endpoint.include?(exclusion) } || !endpoint.include?('.')
35
+ end
36
+
37
+ endpoints_description = extract_description(scope['description'])
38
+ endpoints_description&.each do |endpoint_description|
39
+ endpoint_description = normalize(endpoint_description)
40
+ scopes_normalized << endpoint_description unless exclusions.any? { |exclusion| endpoint_description.include?(exclusion) } || !endpoint_description.include?('.')
41
+ end
36
42
  end
37
43
 
38
44
  scopes_normalized
@@ -42,5 +48,14 @@ class Intigriti
42
48
  endpoint.gsub('/*', '').gsub(' ', '').sub('.*', '.com').sub('.<tld>', '.com')
43
49
  .sub(%r{/$}, '').sub(/\*$/, '')
44
50
  end
51
+
52
+ def self.extract_description(description)
53
+ return [] unless description
54
+
55
+ match = description.match(/In Scope(.*)Out of Scope/im)
56
+ return unless match && match[1]
57
+
58
+ match[1].scan(/\*\.[\w.-]+\.\w+/)
59
+ end
45
60
  end
46
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scopes_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua MARTINELLE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-22 00:00:00.000000000 Z
11
+ date: 2023-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize