Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: input helper in executor options #5712

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

iuliu8899
Copy link
Contributor

Proposed changes

Running ssl type templates will have error since no input transform applied when using nuclei as sdk. To reproduce, run following code.

package main

import (
	"context"

	nuclei "github.com/projectdiscovery/nuclei/v3/lib"
)

func main() {
	ne, err := nuclei.NewNucleiEngineCtx(context.Background(),
		nuclei.WithTemplateFilters(nuclei.TemplateFilters{IDs: []string{"deprecated-tls"}}),
		nuclei.WithVerbosity(
			nuclei.VerbosityOptions{
				Verbose:       true,
				Silent:        false,
				Debug:         true,
				DebugRequest:  false,
				DebugResponse: false,
				ShowVarDump:   false,
			},
		),
	)
	if err != nil {
		panic(err)
	}
	// load targets and optionally probe non http/https targets
	ne.LoadTargets([]string{"https://www.baidu.com:443"}, false)
	err = ne.ExecuteWithCallback(nil)
	if err != nil {
		panic(err)
	}
	defer ne.Close()
}

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@GeorginaReeder
Copy link

Thanks so much for your contribution @iuliu8899 , we appreciate it! :)

@dwisiswant0
Copy link
Member

Could you create the issue first, @iuliu8899?

@dwisiswant0 dwisiswant0 linked an issue Oct 11, 2024 that may be closed by this pull request
1 task
Copy link
Member

@dogancanbakir dogancanbakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before:

$ go run . 
[WRN] [deprecated-tls] Could not execute step: [deprecated-tls,tlsx:RUNTIME] tlsx requires valid address got port=,hostname=,ip= <- could not connect to server

after:

$ go run .
[VER] [deprecated-tls] Sent SSL request to www.baidu.com:443
[DBG] [deprecated-tls] Dumped SSL request for www.baidu.com:443 address=www.baidu.com:443
[DBG] [deprecated-tls] Dumped SSL response for www.baidu.com:443
{"timestamp":"2024-10-14T15:59:27.439777+03:00","host":"www.baidu.com","ip":"198.18.1.187","port":"443","probe_status":true,"tls_version":"tls11","cipher":"TLS_ECDHE_RSA_WITH_RC4_128_SHA","not_before":"2024-07-08T01:41:02Z","not_after":"2025-08-09T01:41:01Z","subject_dn":"CN=baidu.com, O=Beijing Baidu Netcom Science Technology Co.\\, Ltd, L=beijing, ST=beijing, C=CN","subject_cn":"baidu.com","subject_org":["Beijing Baidu Netcom Science Technology Co., Ltd"],"subject_an":["baidu.com","baifubao.com","www.baidu.cn","www.baidu.com.cn","mct.y.nuomi.com","apollo.auto","dwz.cn","*.baidu.com","*.baifubao.com","*.baidustatic.com","*.bdstatic.com","*.bdimg.com","*.hao123.com","*.nuomi.com","*.chuanke.com","*.trustgo.com","*.bce.baidu.com","*.eyun.baidu.com","*.map.baidu.com","*.mbd.baidu.com","*.fanyi.baidu.com","*.baidubce.com","*.mipcdn.com","*.news.baidu.com","*.baidupcs.com","*.aipage.com","*.aipage.cn","*.bcehost.com","*.safe.baidu.com","*.im.baidu.com","*.baiducontent.com","*.dlnel.com","*.dlnel.org","*.dueros.baidu.com","*.su.baidu.com","*.91.com","*.hao123.baidu.com","*.apollo.auto","*.xueshu.baidu.com","*.bj.baidubce.com","*.gz.baidubce.com","*.smartapps.cn","*.bdtjrcv.com","*.hao222.com","*.haokan.com","*.pae.baidu.com","*.vd.bdstatic.com","*.cloud.baidu.com","click.hm.baidu.com","log.hm.baidu.com","cm.pos.baidu.com","wn.pos.baidu.com","update.pan.baidu.com"],"domains":["cloud.baidu.com","chuanke.com","aipage.cn","safe.baidu.com","91.com","hao123.baidu.com","bj.baidubce.com","bdtjrcv.com","dwz.cn","bce.baidu.com","map.baidu.com","mbd.baidu.com","baiducontent.com","hao222.com","www.baidu.cn","www.baidu.com.cn","fanyi.baidu.com","bcehost.com","haokan.com","update.pan.baidu.com","baifubao.com","apollo.auto","baidupcs.com","dlnel.org","dueros.baidu.com","gz.baidubce.com","vd.bdstatic.com","baidustatic.com","trustgo.com","mipcdn.com","xueshu.baidu.com","baidu.com","nuomi.com","eyun.baidu.com","news.baidu.com","pae.baidu.com","click.hm.baidu.com","smartapps.cn","bdimg.com","hao123.com","baidubce.com","aipage.com","im.baidu.com","dlnel.com","su.baidu.com","mct.y.nuomi.com","bdstatic.com","log.hm.baidu.com","cm.pos.baidu.com","wn.pos.baidu.com"],"serial":"4E:40:03:A6:5E:B6:81:F8:7F:4B:D8:EB","issuer_dn":"CN=GlobalSign RSA OV SSL CA 2018, O=GlobalSign nv-sa, C=BE","issuer_cn":"GlobalSign RSA OV SSL CA 2018","issuer_org":["GlobalSign nv-sa"],"fingerprint_hash":{"md5":"d7d7267b23de905436a35f5adedb94db","sha1":"ef0fbe1302e2c4d489ba8fba88ef6f95dccf7be0","sha256":"9073ded9d993a934c29c5ec3c6afa7286d2f0f8848352f94d02035865d8568e2"},"wildcard_certificate":true,"tls_connection":"ctls","sni":"www.baidu.com","client_cert_required":false}
[deprecated-tls] www.baidu.com:443
[VER] [deprecated-tls] Sent SSL request to www.baidu.com:443
[DBG] [deprecated-tls] Dumped SSL request for www.baidu.com:443 address=www.baidu.com:443
[DBG] [deprecated-tls] Dumped SSL response for www.baidu.com:443
{"timestamp":"2024-10-14T15:59:31.327903+03:00","host":"www.baidu.com","ip":"198.18.1.187","port":"443","probe_status":true,"tls_version":"tls10","cipher":"TLS_ECDHE_RSA_WITH_RC4_128_SHA","not_before":"2024-07-08T01:41:02Z","not_after":"2025-08-09T01:41:01Z","subject_dn":"CN=baidu.com, O=Beijing Baidu Netcom Science Technology Co.\\, Ltd, L=beijing, ST=beijing, C=CN","subject_cn":"baidu.com","subject_org":["Beijing Baidu Netcom Science Technology Co., Ltd"],"subject_an":["baidu.com","baifubao.com","www.baidu.cn","www.baidu.com.cn","mct.y.nuomi.com","apollo.auto","dwz.cn","*.baidu.com","*.baifubao.com","*.baidustatic.com","*.bdstatic.com","*.bdimg.com","*.hao123.com","*.nuomi.com","*.chuanke.com","*.trustgo.com","*.bce.baidu.com","*.eyun.baidu.com","*.map.baidu.com","*.mbd.baidu.com","*.fanyi.baidu.com","*.baidubce.com","*.mipcdn.com","*.news.baidu.com","*.baidupcs.com","*.aipage.com","*.aipage.cn","*.bcehost.com","*.safe.baidu.com","*.im.baidu.com","*.baiducontent.com","*.dlnel.com","*.dlnel.org","*.dueros.baidu.com","*.su.baidu.com","*.91.com","*.hao123.baidu.com","*.apollo.auto","*.xueshu.baidu.com","*.bj.baidubce.com","*.gz.baidubce.com","*.smartapps.cn","*.bdtjrcv.com","*.hao222.com","*.haokan.com","*.pae.baidu.com","*.vd.bdstatic.com","*.cloud.baidu.com","click.hm.baidu.com","log.hm.baidu.com","cm.pos.baidu.com","wn.pos.baidu.com","update.pan.baidu.com"],"domains":["baidustatic.com","bdstatic.com","dlnel.org","91.com","xueshu.baidu.com","cloud.baidu.com","click.hm.baidu.com","cm.pos.baidu.com","wn.pos.baidu.com","mct.y.nuomi.com","hao123.com","nuomi.com","baidubce.com","bcehost.com","baiducontent.com","haokan.com","eyun.baidu.com","aipage.com","hao123.baidu.com","log.hm.baidu.com","update.pan.baidu.com","www.baidu.cn","fanyi.baidu.com","mipcdn.com","im.baidu.com","dlnel.com","bdtjrcv.com","hao222.com","pae.baidu.com","www.baidu.com.cn","apollo.auto","su.baidu.com","bj.baidubce.com","gz.baidubce.com","vd.bdstatic.com","baidu.com","trustgo.com","news.baidu.com","dwz.cn","bdimg.com","chuanke.com","bce.baidu.com","mbd.baidu.com","aipage.cn","safe.baidu.com","dueros.baidu.com","smartapps.cn","baifubao.com","map.baidu.com","baidupcs.com"],"serial":"4E:40:03:A6:5E:B6:81:F8:7F:4B:D8:EB","issuer_dn":"CN=GlobalSign RSA OV SSL CA 2018, O=GlobalSign nv-sa, C=BE","issuer_cn":"GlobalSign RSA OV SSL CA 2018","issuer_org":["GlobalSign nv-sa"],"fingerprint_hash":{"md5":"d7d7267b23de905436a35f5adedb94db","sha1":"ef0fbe1302e2c4d489ba8fba88ef6f95dccf7be0","sha256":"9073ded9d993a934c29c5ec3c6afa7286d2f0f8848352f94d02035865d8568e2"},"wildcard_certificate":true,"tls_connection":"ctls","sni":"www.baidu.com","client_cert_required":false}
[deprecated-tls] www.baidu.com:443
[VER] [deprecated-tls] Sent SSL request to www.baidu.com:443
[DBG] [deprecated-tls] Dumped SSL request for www.baidu.com:443 address=www.baidu.com:443
[DBG] [deprecated-tls] Dumped SSL response for www.baidu.com:443
{"timestamp":"2024-10-14T15:59:35.054938+03:00","host":"www.baidu.com","ip":"198.18.1.187","port":"443","probe_status":true,"tls_version":"ssl30","cipher":"TLS_ECDHE_RSA_WITH_RC4_128_SHA","not_before":"2024-07-08T01:41:02Z","not_after":"2025-08-09T01:41:01Z","subject_dn":"CN=baidu.com, O=Beijing Baidu Netcom Science Technology Co.\\, Ltd, L=beijing, ST=beijing, C=CN","subject_cn":"baidu.com","subject_org":["Beijing Baidu Netcom Science Technology Co., Ltd"],"subject_an":["baidu.com","baifubao.com","www.baidu.cn","www.baidu.com.cn","mct.y.nuomi.com","apollo.auto","dwz.cn","*.baidu.com","*.baifubao.com","*.baidustatic.com","*.bdstatic.com","*.bdimg.com","*.hao123.com","*.nuomi.com","*.chuanke.com","*.trustgo.com","*.bce.baidu.com","*.eyun.baidu.com","*.map.baidu.com","*.mbd.baidu.com","*.fanyi.baidu.com","*.baidubce.com","*.mipcdn.com","*.news.baidu.com","*.baidupcs.com","*.aipage.com","*.aipage.cn","*.bcehost.com","*.safe.baidu.com","*.im.baidu.com","*.baiducontent.com","*.dlnel.com","*.dlnel.org","*.dueros.baidu.com","*.su.baidu.com","*.91.com","*.hao123.baidu.com","*.apollo.auto","*.xueshu.baidu.com","*.bj.baidubce.com","*.gz.baidubce.com","*.smartapps.cn","*.bdtjrcv.com","*.hao222.com","*.haokan.com","*.pae.baidu.com","*.vd.bdstatic.com","*.cloud.baidu.com","click.hm.baidu.com","log.hm.baidu.com","cm.pos.baidu.com","wn.pos.baidu.com","update.pan.baidu.com"],"domains":["smartapps.cn","bdtjrcv.com","click.hm.baidu.com","baiducontent.com","dlnel.com","dlnel.org","91.com","hao123.baidu.com","su.baidu.com","xueshu.baidu.com","gz.baidubce.com","baidustatic.com","fanyi.baidu.com","news.baidu.com","baidupcs.com","aipage.cn","hao222.com","vd.bdstatic.com","map.baidu.com","mipcdn.com","haokan.com","pae.baidu.com","wn.pos.baidu.com","bj.baidubce.com","cm.pos.baidu.com","mct.y.nuomi.com","apollo.auto","bdimg.com","eyun.baidu.com","aipage.com","baidu.com","bdstatic.com","hao123.com","cloud.baidu.com","baifubao.com","nuomi.com","trustgo.com","safe.baidu.com","bcehost.com","dueros.baidu.com","log.hm.baidu.com","www.baidu.cn","www.baidu.com.cn","chuanke.com","bce.baidu.com","baidubce.com","update.pan.baidu.com","dwz.cn","mbd.baidu.com","im.baidu.com"],"serial":"4E:40:03:A6:5E:B6:81:F8:7F:4B:D8:EB","issuer_dn":"CN=GlobalSign RSA OV SSL CA 2018, O=GlobalSign nv-sa, C=BE","issuer_cn":"GlobalSign RSA OV SSL CA 2018","issuer_org":["GlobalSign nv-sa"],"fingerprint_hash":{"md5":"d7d7267b23de905436a35f5adedb94db","sha1":"ef0fbe1302e2c4d489ba8fba88ef6f95dccf7be0","sha256":"9073ded9d993a934c29c5ec3c6afa7286d2f0f8848352f94d02035865d8568e2"},"wildcard_certificate":true,"tls_connection":"ztls","sni":"www.baidu.com","client_hello":{"version":{"name":"SSLv3","value":768},"random":"8viUJLydCPJCvphW8e9whVZslAE5G31Qn5IhnYyRadQ=","cipher_suites":[{"hex":"0x0011","name":"TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA","value":17},{"hex":"0x0035","name":"TLS_RSA_WITH_AES_256_CBC_SHA","value":53},{"hex":"0x002F","name":"TLS_RSA_WITH_AES_128_CBC_SHA","value":47},{"hex":"0xC012","name":"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA","value":49170},{"hex":"0x0014","name":"TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA","value":20},{"hex":"0xC011","name":"TLS_ECDHE_RSA_WITH_RC4_128_SHA","value":49169},{"hex":"0x0012","name":"TLS_DHE_DSS_WITH_DES_CBC_SHA","value":18},{"hex":"0x0033","name":"TLS_DHE_RSA_WITH_AES_128_CBC_SHA","value":51},{"hex":"0x0039","name":"TLS_DHE_RSA_WITH_AES_256_CBC_SHA","value":57},{"hex":"0xC007","name":"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA","value":49159},{"hex":"0x0003","name":"TLS_RSA_EXPORT_WITH_RC4_40_MD5","value":3},{"hex":"0xC008","name":"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA","value":49160},{"hex":"0x0004","name":"TLS_RSA_WITH_RC4_128_MD5","value":4},{"hex":"0x0032","name":"TLS_DHE_DSS_WITH_AES_128_CBC_SHA","value":50},{"hex":"0xC009","name":"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA","value":49161},{"hex":"0x0006","name":"TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5","value":6},{"hex":"0x000A","name":"TLS_RSA_WITH_3DES_EDE_CBC_SHA","value":10},{"hex":"0x0038","name":"TLS_DHE_DSS_WITH_AES_256_CBC_SHA","value":56},{"hex":"0x0016","name":"TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA","value":22},{"hex":"0x0013","name":"TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA","value":19},{"hex":"0x0015","name":"TLS_DHE_RSA_WITH_DES_CBC_SHA","value":21},{"hex":"0xC014","name":"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA","value":49172},{"hex":"0xC00A","name":"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA","value":49162},{"hex":"0x0017","name":"TLS_DH_ANON_EXPORT_WITH_RC4_40_MD5","value":23},{"hex":"0x0066","name":"TLS_DHE_DSS_WITH_RC4_128_SHA","value":102},{"hex":"0x0008","name":"TLS_RSA_EXPORT_WITH_DES40_CBC_SHA","value":8},{"hex":"0x0019","name":"TLS_DH_ANON_EXPORT_WITH_DES40_CBC_SHA","value":25},{"hex":"0x0005","name":"TLS_RSA_WITH_RC4_128_SHA","value":5},{"hex":"0xC013","name":"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA","value":49171}],"compression_methods":"AA==","ocsp_stapling":true,"ticket":false,"secure_renegotiation":true,"heartbeat":false,"extended_master_secret":false,"next_protocol_negotiation":false,"server_name":"www.baidu.com","scts":false,"supported_curves":[{"hex":"0x0017","name":"secp256r1","value":23},{"hex":"0x0018","name":"secp384r1","value":24},{"hex":"0x0019","name":"secp521r1","value":25}],"supported_point_formats":"AA==","sct_enabled":false},"servers_hello":{"version":{"name":"SSLv3","value":768},"random":"Zw0VtnSn6odiCaqwuXVJpbFG6E6L5AfPNm7rSeIZVVc=","session_id":"AiruOxjTb3k0VGXp7McsjMzmYo4RqZ/zuak8louK5mQ=","cipher_suite":{"hex":"0xC011","name":"TLS_ECDHE_RSA_WITH_RC4_128_SHA","value":49169},"compression_method":{"hex":"0x00","name":"NULL","value":0},"ocsp_stapling":false,"ticket":false,"secure_renegotiation":true,"heartbeat":false,"extended_master_secret":false,"next_protocol_negotiation":false,"unknown_extensions":["AAsAAgEA"]},"client_cert_required":false}
[deprecated-tls] www.baidu.com:443

@ehsandeep ehsandeep merged commit aab2cad into projectdiscovery:dev Oct 14, 2024
8 of 12 checks passed
@iuliu8899 iuliu8899 deleted the bugfix-input-helper-sdk branch October 21, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] no input helper in executor options when using as sdk
5 participants