msg_file_loctl_ext.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package smb
  2. const (
  3. RPC_VERSION = 5
  4. RPC_VERSION_MINOR = 0
  5. RPC_TYPE_REQUEST = 0
  6. RPC_TYPE_RESPONSE = 2
  7. RPC_TYPE_BIND = 11
  8. RPC_TYPE_BIND_ACK = 12
  9. RPC_PACKET_FLAG_FIRST = 0x01
  10. RPC_PACKET_FLAG_LAST = 0x02
  11. SRVSVC_VERSION = 3
  12. SRVSVC_VERSION_MINOR = 0
  13. NDR_VERSION = 2
  14. OP_NET_SHARE_ENUM = 15
  15. )
  16. var (
  17. SRVSVC_UUID = []byte("c84f324b7016d30112785a47bf6ee188")
  18. NDR_UUID = []byte("045d888aeb1cc9119fe808002b104860")
  19. )
  20. type Bind struct {
  21. VERSION uint8
  22. VERSION_MINOR uint8
  23. PACKET_TYPE_BIND uint8
  24. PACKET_FLAGS uint8
  25. DataRepresentation uint32
  26. FragLength uint16
  27. AuthLength uint16
  28. CallId uint32
  29. MaxXmitFrag uint16
  30. MaxRecvFrag uint16
  31. AssocGroup uint32
  32. NumCtxItems uint32
  33. }
  34. // type Bind struct {
  35. // CallId uint32
  36. // }
  37. // func (r *Bind) Size() int {
  38. // return 72
  39. // }
  40. // func (r *Bind) Encode(b []byte) {
  41. // b[0] = RPC_VERSION
  42. // b[1] = RPC_VERSION_MINOR
  43. // b[2] = RPC_TYPE_BIND
  44. // b[3] = RPC_PACKET_FLAG_FIRST | RPC_PACKET_FLAG_LAST
  45. // // order = Little-Endian, float = IEEE, char = ASCII
  46. // b[4] = 0x10
  47. // b[5] = 0
  48. // b[6] = 0
  49. // b[7] = 0
  50. // le.PutUint16(b[8:10], 72) // frag length
  51. // le.PutUint16(b[10:12], 0) // auth length
  52. // le.PutUint32(b[12:16], r.CallId) // call id
  53. // le.PutUint16(b[16:18], 4280) // max xmit frag
  54. // le.PutUint16(b[18:20], 4280) // max recv frag
  55. // le.PutUint32(b[20:24], 0) // assoc group
  56. // le.PutUint32(b[24:28], 1) // num ctx items
  57. // le.PutUint16(b[28:30], 0) // ctx item[1] .context id
  58. // le.PutUint16(b[30:32], 1) // ctx item[1] .num trans items
  59. // hex.Decode(b[32:48], SRVSVC_UUID)
  60. // le.PutUint16(b[48:50], SRVSVC_VERSION)
  61. // le.PutUint16(b[50:52], SRVSVC_VERSION_MINOR)
  62. // hex.Decode(b[52:68], NDR_UUID)
  63. // le.PutUint32(b[68:72], NDR_VERSION)
  64. // }