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

update fingerprints_data.json problem when use wappalyzergo as library #52

Open
LazyMaple opened this issue Jul 10, 2023 · 0 comments
Open

Comments

@LazyMaple
Copy link

hi, i use wappalyzergo as library,the fingerprints_data.json file is bound to the repo code. When I update the json file, I need to update the whole golang project, I think it would be nice to have a function on the Wappalyze object to define fingerprints, In this way, when used as a function library, it avoids constantly updating the entire project code in order to update the data file

image
// now I use some tricks to solve this problem
// the wappalyzerFileBytes define from outter resource, such as cloud object storage service

//go:linkname compileFingerprint github.com/projectdiscovery/wappalyzergo.compileFingerprint
func compileFingerprint(fingerprint *wappalyzer.Fingerprint) *wappalyzer.CompiledFingerprint

type WappalyzeWithUnsafe struct {
	fingerprints unsafe.Pointer
}

func NewWappalyzerClient() *wappalyzer.Wappalyze {
	EnsureWappalyzerFile()

	wappalyzerClient := new(wappalyzer.Wappalyze)
	wappalyzerClientCompiledFingerprints := &wappalyzer.CompiledFingerprints{
		Apps: make(map[string]*wappalyzer.CompiledFingerprint),
	}
	var fingerprintsStruct wappalyzer.Fingerprints
	json.Unmarshal([]byte(wappalyzerFileBytes), &fingerprintsStruct)

	for i, fingerprint := range fingerprintsStruct.Apps {
		wappalyzerClientCompiledFingerprints.Apps[i] = compileFingerprint(fingerprint)
	}

	wappalyzeUnsafe := (*WappalyzeWithUnsafe)(unsafe.Pointer(wappalyzerClient))
	wappalyzeUnsafe.fingerprints = unsafe.Pointer(wappalyzerClientCompiledFingerprints)

	return wappalyzerClient
}
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

No branches or pull requests

1 participant