Skip to content

Commit

Permalink
Add a reminder for failure when hooking libnss3.so. (#677)
Browse files Browse the repository at this point in the history
Change NSS-related naming to NSPR.

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n authored Dec 1, 2024
1 parent 76c5a1a commit 3d578c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions cli/cmd/nss.go → cli/cmd/nspr.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ var nc = config.NewNsprConfig()

// gnutlsCmd represents the openssl command
var nssCmd = &cobra.Command{
Use: "nss",
Aliases: []string{"nspr"},
Use: "nspr",
Aliases: []string{"nss"},
Short: "capture nss/nspr encrypted text content without CA cert for nss/nspr libraries.",
Long: `use eBPF uprobe/TC to capture process event data.
ecapture nss
ecapture nss --hex --pid=3423
ecapture nss -l save.log --pid=3423
ecapture nss --nspr=/lib/x86_64-linux-gnu/libnspr44.so
ecapture nspr
ecapture nspr --hex --pid=3423
ecapture nspr -l save.log --pid=3423
ecapture nspr --nspr=/lib/x86_64-linux-gnu/libnspr44.so
`,
Run: nssCommandFunc,
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func runModule(modName string, modConfig config.IConfig) {

err = mod.Run()
if err != nil {
logger.Fatal().Err(err).Bool("isReload", isReload).Msg("module run failed, skip it.")
logger.Fatal().Err(err).Bool("isReload", isReload).Msg("module run failed.")
}
logger.Info().Str("moduleName", modName).Bool("isReload", isReload).Msg("module started successfully.")

Expand Down
5 changes: 5 additions & 0 deletions user/module/probe_nspr.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"math"
"os"
"path"
"strings"
)

type MNsprProbe struct {
Expand Down Expand Up @@ -147,6 +148,10 @@ func (n *MNsprProbe) setupManagers() error {
}

n.logger.Info().Str("binrayPath", binaryPath).Uint8("ElfType", n.conf.(*config.NsprConfig).ElfType).Msg("HOOK type:nspr elf")
if strings.Contains(binaryPath, "libnss3.so") || strings.Contains(binaryPath, "libnss.so") {
n.logger.Warn().Msg("In normal circumstances, the PR_Write/PR_Read functions should be in libnspr4.so. If it fails to run, please try specifying the --nspr=/xxx/libnspr4.so path. ")
n.logger.Warn().Msg("For more information, please refer to https://github.com/gojue/ecapture/issues/662 .")
}
n.bpfManager = &manager.Manager{
Probes: []*manager.Probe{
{
Expand Down

0 comments on commit 3d578c8

Please sign in to comment.