Skip to content

Commit ef50c10

Browse files
committed
feat: Supports the specified listed cloud services
1 parent 5e192ae commit ef50c10

File tree

21 files changed

+676
-385
lines changed

21 files changed

+676
-385
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [v1.1.0](https://github.com/wgpsec/lc/releases/tag/v1.1.0) 2024.10.6
4+
5+
* 支持列出阿里云 FC 函数计算服务
6+
* 支持在列出时指定要列出的云服务类型
7+
38
## [v1.0.1](https://github.com/wgpsec/lc/releases/tag/v1.0.1) 2024.5.15
49

510
* 支持列出移动云 EOS 对象存储服务

cmd/banner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const banner = `
1010
/_____/_/____/\__/ \____/_/\____/\__,_/\__,_/
1111
`
1212

13-
const version = "1.0.2"
14-
const versionDate = "2024-8-10"
13+
const version = "1.1.0"
14+
const versionDate = "2024-10-6"
1515

1616
func showBanner() {
1717
gologger.Print().Msgf("%s\n", banner)

cmd/configFile.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const defaultConfigFile = `# # lc (list cloud) 的云服务商配置文件
1919
# # 访问凭证获取地址:https://ram.console.aliyun.com
2020
# - provider: aliyun
2121
# id: aliyun_default
22+
# cloud_services: ecs,oss,rds,fc
2223
# access_key:
2324
# secret_key:
2425
# session_token:
@@ -27,6 +28,7 @@ const defaultConfigFile = `# # lc (list cloud) 的云服务商配置文件
2728
# # 访问凭证获取地址:https://console.cloud.tencent.com/cam
2829
# - provider: tencent
2930
# id: tencent_cloud_default
31+
# cloud_services: cvm,lh,cos
3032
# access_key:
3133
# secret_key:
3234
# session_token:
@@ -35,21 +37,24 @@ const defaultConfigFile = `# # lc (list cloud) 的云服务商配置文件
3537
# # 访问凭证获取地址:https://console.huaweicloud.com/iam
3638
# - provider: huawei
3739
# id: huawei_cloud_default
40+
# cloud_services: obs
3841
# access_key:
3942
# secret_key:
4043
# session_token:
4144
4245
# # 天翼云
4346
# # 访问凭证获取地址:https://oos-cn.ctyun.cn/oos/ctyun/iam/dist/index.html#/certificate
4447
# - provider: tianyi
45-
# id: tianyi_cloud_default
46-
# access_key:
47-
# secret_key:
48+
# id: tianyi_cloud_default
49+
# cloud_services: oos
50+
# access_key:
51+
# secret_key:
4852
4953
# # 百度云
5054
# # 访问凭证获取地址:https://console.bce.baidu.com/iam/
5155
# - provider: baidu
5256
# id: baidu_cloud_default
57+
# cloud_services: bos,bcc
5358
# access_key:
5459
# secret_key:
5560
# session_token:
@@ -58,6 +63,7 @@ const defaultConfigFile = `# # lc (list cloud) 的云服务商配置文件
5863
# # 访问凭证获取地址:https://console.cucloud.cn/console/uiam
5964
# - provider: liantong
6065
# id: liantong_cloud_default
66+
# cloud_services: oss
6167
# access_key:
6268
# secret_key:
6369
# session_token:
@@ -66,13 +72,15 @@ const defaultConfigFile = `# # lc (list cloud) 的云服务商配置文件
6672
# # 访问凭证获取地址:https://portal.qiniu.com/developer/user/key
6773
# - provider: qiniu
6874
# id: qiniu_cloud_default
75+
# cloud_services: kodo
6976
# access_key:
7077
# secret_key:
7178
7279
# # 移动云
7380
# # 访问凭证获取地址:https://console.ecloud.10086.cn/api/page/eos-console-web/CIDC-RP-00/eos/key
7481
# - provider: yidong
7582
# id: yidong_cloud_default
83+
# cloud_services: eos
7684
# access_key:
7785
# secret_key:
7886
# session_token:

cmd/options.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Options struct {
2121
Output string // Output 将结果写入到文件中
2222
Provider goflags.StringSlice // Provider 指定要列出的云服务商
2323
Id goflags.StringSlice // Id 指定要列出的对象
24+
CloudServices goflags.StringSlice // CloudServices 指定要列出的服务
2425
}
2526

2627
var (
@@ -37,6 +38,8 @@ func ParseOptions() *Options {
3738
flagSet.IntVarP(&options.Threads, "threads", "t", 3, "指定扫描的线程数量"),
3839
)
3940
flagSet.CreateGroup("filter", "过滤",
41+
flagSet.StringSliceVarP(&options.CloudServices, "cloud-services", "cs", goflags.StringSlice{"all"}, "指定要列出的服务",
42+
goflags.NormalizedStringSliceOptions),
4043
flagSet.StringSliceVarP(&options.Id, "id", "i", nil, "指定要使用的配置(以逗号分隔)", goflags.NormalizedStringSliceOptions),
4144
flagSet.StringSliceVarP(&options.Provider, "provider", "p", nil, "指定要使用的云服务商(以逗号分隔)", goflags.NormalizedStringSliceOptions),
4245
flagSet.BoolVarP(&options.ExcludePrivate, "exclude-private", "ep", false, "从输出的结果中排除私有 IP"),

cmd/runner.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ func (r *Runner) Enumerate() {
5252
finalConfig = append(finalConfig, item)
5353
}
5454
}
55-
inventory, err := inventory.New(finalConfig)
55+
56+
inventory, err := inventory.New(finalConfig, r.options.CloudServices)
5657
if err != nil {
5758
gologger.Fatal().Msgf("%s", err)
5859
}
@@ -68,7 +69,7 @@ func (r *Runner) Enumerate() {
6869
schema.SetThreads(r.options.Threads)
6970
for _, provider := range inventory.Providers {
7071
gologger.Info().Msgf("正在列出 %s (%s) 的资产\n", provider.Name(), provider.ID())
71-
instances, err := provider.Resources(context.Background())
72+
instances, err := provider.Resources(context.Background(), r.options.CloudServices)
7273
if err != nil {
7374
gologger.Error().Msgf("无法获取 %s(%s)的资产: %s\n", provider.Name(), provider.ID(), err)
7475
continue
@@ -102,7 +103,7 @@ func (r *Runner) Enumerate() {
102103
}
103104
}
104105
if Count == 0 {
105-
gologger.Info().Msgf("在 %s (%s) 下未发现资产,这一般是由于权限不足或没有资产。", provider.Name(), provider.ID())
106+
gologger.Info().Msgf("在 %s (%s) 下未发现资产,这可能是由于权限不足或没有资产,您可以在确认有相关权限后再进行尝试。", provider.Name(), provider.ID())
106107
}
107108
if !r.options.Silent {
108109
fmt.Println()

go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module github.com/wgpsec/lc
33
go 1.22.1
44

55
require (
6-
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.8
6+
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9
7+
github.com/alibabacloud-go/fc-20230330/v4 v4.1.3
78
github.com/alibabacloud-go/fc-open-20210406/v2 v2.0.12
89
github.com/aliyun/alibaba-cloud-sdk-go v1.62.712
910
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
@@ -25,12 +26,12 @@ require (
2526
require (
2627
github.com/alibabacloud-go/alibabacloud-gateway-fc-util v0.0.7 // indirect
2728
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
28-
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
29+
github.com/alibabacloud-go/debug v1.0.0 // indirect
2930
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
3031
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
31-
github.com/alibabacloud-go/tea v1.2.1 // indirect
32+
github.com/alibabacloud-go/tea v1.2.2 // indirect
3233
github.com/alibabacloud-go/tea-utils v1.3.1 // indirect
33-
github.com/alibabacloud-go/tea-utils/v2 v2.0.5 // indirect
34+
github.com/alibabacloud-go/tea-utils/v2 v2.0.6 // indirect
3435
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
3536
github.com/aliyun/credentials-go v1.3.1 // indirect
3637
github.com/andybalholm/brotli v1.0.6 // indirect

go.sum

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ github.com/alibabacloud-go/alibabacloud-gateway-fc-util v0.0.7/go.mod h1:H0RPHXH
88
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 h1:iC9YFYKDGEy3n/FtqJnOkZsene9olVspKmkX5A2YBEo=
99
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc=
1010
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.5/go.mod h1:kUe8JqFmoVU7lfBauaDD5taFaW7mBI+xVsyHutYtabg=
11-
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.8 h1:benoD0QHDrylMzEQVpX/6uKtrN8LohT66ZlKXVJh7pM=
12-
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.8/go.mod h1:CzQnh+94WDnJOnKZH5YRyouL+OOcdBnXY5VWAf0McgI=
13-
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50=
11+
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9 h1:fxMCrZatZfXq5nLcgkmWBXmU3FLC1OR+m/SqVtMqflk=
12+
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9/go.mod h1:bb+Io8Sn2RuM3/Rpme6ll86jMyFSrD1bxeV/+v61KeU=
1413
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY=
14+
github.com/alibabacloud-go/debug v1.0.0 h1:3eIEQWfay1fB24PQIEzXAswlVJtdQok8f3EVN5VrBnA=
15+
github.com/alibabacloud-go/debug v1.0.0/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc=
1516
github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
1617
github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
18+
github.com/alibabacloud-go/fc-20230330/v4 v4.1.3 h1:/4/A8pD6WBoy3LdDASyrQ36cBF7KhN6nIHGKPpcdsBE=
19+
github.com/alibabacloud-go/fc-20230330/v4 v4.1.3/go.mod h1:bwrdz9JVW4Qyhk4rmKZAQgJojRM58UJGXD5v+cQD83Y=
1720
github.com/alibabacloud-go/fc-open-20210406/v2 v2.0.12 h1:A3D8Mp6qf8DfR6Dt5MpS8aDVaWfS4N85T5CvGUvgrjM=
1821
github.com/alibabacloud-go/fc-open-20210406/v2 v2.0.12/go.mod h1:F5c0E5UB3k8v6neTtw3FBcJ1YCNFzVoL1JPRHTe33u4=
1922
github.com/alibabacloud-go/openapi-util v0.1.0 h1:0z75cIULkDrdEhkLWgi9tnLe+KhAFE/r5Pb3312/eAY=
@@ -22,13 +25,14 @@ github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9Q
2225
github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
2326
github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
2427
github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
25-
github.com/alibabacloud-go/tea v1.2.1 h1:rFF1LnrAdhaiPmKwH5xwYOKlMh66CqRwPUTzIK74ask=
2628
github.com/alibabacloud-go/tea v1.2.1/go.mod h1:qbzof29bM/IFhLMtJPrgTGK3eauV5J2wSyEUo4OEmnA=
29+
github.com/alibabacloud-go/tea v1.2.2 h1:aTsR6Rl3ANWPfqeQugPglfurloyBJY85eFy7Gc1+8oU=
30+
github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk=
2731
github.com/alibabacloud-go/tea-utils v1.3.1 h1:iWQeRzRheqCMuiF3+XkfybB3kTgUXkXX+JMrqfLeB2I=
2832
github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
2933
github.com/alibabacloud-go/tea-utils/v2 v2.0.4/go.mod h1:sj1PbjPodAVTqGTA3olprfeeqqmwD0A5OQz94o9EuXQ=
30-
github.com/alibabacloud-go/tea-utils/v2 v2.0.5 h1:EUakYEUAwr6L3wLT0vejIw2rc0IA1RSXDwLnIb3f2vU=
31-
github.com/alibabacloud-go/tea-utils/v2 v2.0.5/go.mod h1:dL6vbUT35E4F4bFTHL845eUloqaerYBYPsdWR2/jhe4=
34+
github.com/alibabacloud-go/tea-utils/v2 v2.0.6 h1:ZkmUlhlQbaDC+Eba/GARMPy6hKdCLiSke5RsN5LcyQ0=
35+
github.com/alibabacloud-go/tea-utils/v2 v2.0.6/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I=
3236
github.com/alibabacloud-go/tea-xml v1.1.3 h1:7LYnm+JbOq2B+T/B0fHC4Ies4/FofC4zHzYtqw7dgt0=
3337
github.com/alibabacloud-go/tea-xml v1.1.3/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8=
3438
github.com/aliyun/alibaba-cloud-sdk-go v1.62.712 h1:lM7JnA9dEdDFH9XOgRNQMDTQnOjlLkDTNA7c0aWTQ30=
@@ -227,7 +231,7 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
227231
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
228232
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
229233
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
230-
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
234+
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
231235
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
232236
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
233237
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -257,7 +261,6 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
257261
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
258262
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
259263
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
260-
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
261264
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
262265
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
263266
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -282,7 +285,7 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
282285
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
283286
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
284287
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
285-
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
288+
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
286289
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
287290
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
288291
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -291,7 +294,7 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
291294
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
292295
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
293296
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
294-
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
297+
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
295298
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
296299
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
297300
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -301,7 +304,6 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
301304
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
302305
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
303306
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
304-
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
305307
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
306308
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
307309
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// 感谢 github.com/projectdiscovery/cloudlist 项目, 得益
22
// 于 cloudlist 的 MIT 开源协议,为这个 Weekend Project 提
3-
// 供了大量帮助, 此项目也将以 MIT 协议开源,共同助力人类开源项目发展
3+
// 供了大量帮助, 此项目也将以 MIT 协议开源,助力安全开源项目发展
44

55
// Thank you to the github.com/projectdiscovery/cloudlist
66
// project, which has provided substantial assistance to this

pkg/inventory/inventory.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package inventory
22

33
import (
44
"fmt"
5+
"github.com/projectdiscovery/goflags"
56
"github.com/wgpsec/lc/pkg/providers/aliyun"
67
"github.com/wgpsec/lc/pkg/providers/baidu"
78
"github.com/wgpsec/lc/pkg/providers/huawei"
@@ -18,15 +19,15 @@ type Inventory struct {
1819
Providers []schema.Provider
1920
}
2021

21-
func New(options schema.Options) (*Inventory, error) {
22+
func New(options schema.Options, cs goflags.StringSlice) (*Inventory, error) {
2223
inventory := &Inventory{}
2324

2425
for _, block := range options {
2526
value, ok := block.GetMetadata(utils.Provider)
2627
if !ok {
2728
continue
2829
}
29-
provider, err := nameToProvider(value, block)
30+
provider, err := nameToProvider(value, block, cs)
3031
if err != nil {
3132
return nil, err
3233
}
@@ -35,24 +36,24 @@ func New(options schema.Options) (*Inventory, error) {
3536
return inventory, nil
3637
}
3738

38-
func nameToProvider(value string, block schema.OptionBlock) (schema.Provider, error) {
39+
func nameToProvider(value string, block schema.OptionBlock, cs goflags.StringSlice) (schema.Provider, error) {
3940
switch value {
4041
case utils.Aliyun:
41-
return aliyun.New(block)
42+
return aliyun.New(block, cs)
4243
case utils.Tencent:
43-
return tencent.New(block)
44+
return tencent.New(block, cs)
4445
case utils.Huawei:
45-
return huawei.New(block)
46+
return huawei.New(block, cs)
4647
case utils.TianYi:
47-
return tianyi.New(block)
48+
return tianyi.New(block, cs)
4849
case utils.Baidu:
49-
return baidu.New(block)
50+
return baidu.New(block, cs)
5051
case utils.LianTong:
51-
return liantong.New(block)
52+
return liantong.New(block, cs)
5253
case utils.QiNiu:
53-
return qiniu.New(block)
54+
return qiniu.New(block, cs)
5455
case utils.YiDong:
55-
return yidong.New(block)
56+
return yidong.New(block, cs)
5657
default:
5758
return nil, fmt.Errorf("发现无效的云服务商名: %s", value)
5859
}

0 commit comments

Comments
 (0)