当前位置: 首页>>代码示例>>Golang>>正文


Golang Info.Classification方法代码示例

本文整理汇总了Golang中github.com/bnagy/crashwalk/crash.Info.Classification方法的典型用法代码示例。如果您正苦于以下问题:Golang Info.Classification方法的具体用法?Golang Info.Classification怎么用?Golang Info.Classification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/bnagy/crashwalk/crash.Info的用法示例。


在下文中一共展示了Info.Classification方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: parseExploitable

func parseExploitable(raw []byte, ci *crash.Info, die func()) {

	scanner := bufio.NewScanner(bytes.NewReader(raw))

	// Faulting frame: #  4 None at 0x7ffff6fad93b in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0
	// Faulting frame: #  6 operator new(unsigned long) at 0x7ffff6d87698 in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20
	// [  <---ignore--->  ] [  symbol text until "at"  ]     [address]      [ <-- module from here--> ]
	mustAdvanceTo("Faulting frame:", scanner, die)
	ff := strings.Fields(scanner.Text())
	if len(ff) < 9 {
		die()
	}

	atIdx := 0
	for i := 0; i < len(ff); i++ {
		if ff[i] == "at" {
			atIdx = i
			break
		}
	}
	if atIdx == 0 {
		die()
	}

	ci.FaultingFrame = crash.StackEntry{
		Symbol:  strings.Join(ff[4:atIdx], " "),
		Address: mustParseHex(ff[atIdx+1], die),
		// don't know if modules can ever contain spaces?
		Module: strings.Join(ff[atIdx+3:], " "),
	}
	// Description: Abort signal
	mustAddExtra("Description:", scanner, ci, die)
	// Short description: AbortSignal (20/22)
	mustAddExtra("Short description:", scanner, ci, die)
	// Hash: 71c14ffe39944b60af6fd47d1e505f97.0822ff5e99ce7ad4a1e6e98b273082a7
	mustAdvanceTo("Hash:", scanner, die)
	ci.Hash = strings.Fields(scanner.Text())[1]
	// Exploitability Classification: UNKNOWN
	mustAdvanceTo("Exploitability", scanner, die)
	ci.Classification = strings.Fields(scanner.Text())[2]
	// Explanation: The target is stopped on a SIGABRT. [...]
	mustAddExtra("Explanation:", scanner, ci, die)

	return
}
开发者ID:zuBux,项目名称:crashwalk,代码行数:45,代码来源:gdb.go


注:本文中的github.com/bnagy/crashwalk/crash.Info.Classification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。