Skip to content

Commit 11a991a

Browse files
committed
Add a reminder for failure when hooking libnss3.so.
Change NSS-related naming to NSPR. Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
1 parent 76c5a1a commit 11a991a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

cli/cmd/nss.go renamed to cli/cmd/nspr.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ var nc = config.NewNsprConfig()
2727

2828
// gnutlsCmd represents the openssl command
2929
var nssCmd = &cobra.Command{
30-
Use: "nss",
31-
Aliases: []string{"nspr"},
30+
Use: "nspr",
31+
Aliases: []string{"nss"},
3232
Short: "capture nss/nspr encrypted text content without CA cert for nss/nspr libraries.",
3333
Long: `use eBPF uprobe/TC to capture process event data.
34-
ecapture nss
35-
ecapture nss --hex --pid=3423
36-
ecapture nss -l save.log --pid=3423
37-
ecapture nss --nspr=/lib/x86_64-linux-gnu/libnspr44.so
34+
ecapture nspr
35+
ecapture nspr --hex --pid=3423
36+
ecapture nspr -l save.log --pid=3423
37+
ecapture nspr --nspr=/lib/x86_64-linux-gnu/libnspr44.so
3838
`,
3939
Run: nssCommandFunc,
4040
}

cli/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func runModule(modName string, modConfig config.IConfig) {
247247

248248
err = mod.Run()
249249
if err != nil {
250-
logger.Fatal().Err(err).Bool("isReload", isReload).Msg("module run failed, skip it.")
250+
logger.Fatal().Err(err).Bool("isReload", isReload).Msg("module run failed.")
251251
}
252252
logger.Info().Str("moduleName", modName).Bool("isReload", isReload).Msg("module started successfully.")
253253

user/module/probe_nspr.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"math"
3131
"os"
3232
"path"
33+
"strings"
3334
)
3435

3536
type MNsprProbe struct {
@@ -147,6 +148,10 @@ func (n *MNsprProbe) setupManagers() error {
147148
}
148149

149150
n.logger.Info().Str("binrayPath", binaryPath).Uint8("ElfType", n.conf.(*config.NsprConfig).ElfType).Msg("HOOK type:nspr elf")
151+
if strings.Contains(binaryPath, "libnss3.so") || strings.Contains(binaryPath, "libnss.so") {
152+
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. ")
153+
n.logger.Warn().Msg("For more information, please refer to https://github.com/gojue/ecapture/issues/662 .")
154+
}
150155
n.bpfManager = &manager.Manager{
151156
Probes: []*manager.Probe{
152157
{

0 commit comments

Comments
 (0)