当前位置: 移动技术网 > IT编程>脚本编程>Go语言 > Go语言程序调试

Go语言程序调试

2020年04月20日  | 移动技术网IT编程  | 我要评论

1. go语言二进制程序分析
   在分析一些使用golang语言进行编译的恶意程序时,由于程序在被打包成二进制程序时会打包诸多引用的库,并且作者对二进制程序进行了去符号化,导致在动态或是静态分析时函数过多而不便于跟踪。
   而如果go编译成的二进制程序并未进行去符号化,那么在ida中进行分析时,几乎可以相当于看源码了。所以只要将去符号的程序进行符号恢复,那么之后调试时就十分方便了。
   可以使用github上的ida py脚本idagolanghelper,关于go程序恢复符号的资料:[.\ru/wp-content/uploads/2016/12/go_zaytsev.pdf](. ru/wp-content/uploads/2016/12/go_zaytsev.pdf),主要就是为了确认go语言程序特有的.gopclntab段位置,中文可以参考以下。

   另外还可以使用redress对程序包结构进行分析。

2. 加密函数

enryptoaep/decryptoaep

// encryptoaep encrypts the given message with rsa-oaep.
//
// oaep is parameterised by a hash function that is used as a random oracle.
// encryption and decryption of a given message must use the same hash function
// and sha256.new() is a reasonable choice.
//
// the random parameter is used as a source of entropy to ensure that
// encrypting the same message twice doesn't result in the same ciphertext.
//
// the label parameter may contain arbitrary data that will not be encrypted,
// but which gives important context to the message. for example, if a given
// public key is used to decrypt two types of messages then distinct label
// values could be used to ensure that a ciphertext for one purpose cannot be
// used for another by an attacker. if not required it can be empty.
//
// the message must be no longer than the length of the public modulus minus
// twice the hash length, minus a further 2.

encryptoaep(hash hash.hash, random io.reader, pub *publickey, msg []byte, label []byte)
  查看相关源码后,可以知道散列函数hash被用于计算label的hash值;random参数产生hash.size()个强随机数作为seed;计算seed的hash值与包括明文和label的hash值在内的数据进行异或,从而防止旁路攻击。最终使用公钥加密包括seed、hash(label)、明文在内的数据,作为密文。

  加密的消息必须不大于(公钥长度 - 2*hash.size() - 2)。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网