{"record":{"id":"68f0c0dc34318953","repo":"shadow1ng/fscan","slug":"no-transport","errorCode":null,"errorMessage":"no transport","messagePattern":"no transport","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"libs/grdp/protocol/x224/x224.go","lineNumber":233,"sourceCode":"\t\treturn 0, err\n\t}\n\tbuff.Write(b)\n\n\tglog.Trace(\"x224 write:\", hex.EncodeToString(buff.Bytes()))\n\treturn x.transport.Write(buff.Bytes())\n}\n\nfunc (x *X224) Close() error {\n\treturn x.transport.Close()\n}\n\nfunc (x *X224) SetRequestedProtocol(p uint32) {\n\tx.requestedProtocol = p\n}\n\nfunc (x *X224) Connect() error {\n\tif x.transport == nil {\n\t\treturn errors.New(\"no transport\")\n\t}\n\tcookie := \"Cookie: mstshash=bob\"\n\tmessage := NewClientConnectionRequestPDU([]byte(cookie), x.requestedProtocol)\n\tmessage.ProtocolNeg.Type = TYPE_RDP_NEG_REQ\n\tmessage.ProtocolNeg.Result = uint32(x.requestedProtocol)\n\n\tglog.Debug(\"x224 sendConnectionRequest\", hex.EncodeToString(message.Serialize()))\n\t_, err := x.transport.Write(message.Serialize())\n\tx.transport.Once(\"data\", x.recvConnectionConfirm)\n\treturn err\n}\n\nfunc (x *X224) recvConnectionConfirm(s []byte) {\n\t/*\n\t\t在Windows的远程桌面协议（RDP）交互过程中，NLA是指网络级别身份验证（Network Level Authentication）。NLA是一种用于增强远程桌面连接安全性的机制。在启用了NLA的情况下，客户端必须在建立RDP会话之前通过网络级别的身份验证，这样可以防止未经授权的用户连接到远程桌面服务器。\n\n\t\tNLA的优点\n\t\t提高安全性：在建立RDP会话之前进行身份验证，确保只有经过验证的用户才能连接。","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/libs/grdp/protocol/x224/x224.go#L215-L251","documentation":"X224.Connect() refuses to run the RDP connection-request handshake when no underlying transport has been set. The X224 layer is a wrapper over a transport (typically the TCP layer) and must be wired up before connecting. This is a programming/setup error, not a network failure.","triggerScenarios":"Calling x224.Connect() (directly or via NlaAuthOnly / ProbeOSInfo) on an X224 instance whose transport field is nil because NewClientCreate... was never given a transport or the transport setup step was skipped/failed.","commonSituations":"Calling Connect() before NewClient / transport dial succeeded; reusing an X224 object after its transport was closed and nilled; building the protocol stack by hand and forgetting the transport layer.","solutions":["Ensure the transport (e.g. TCP client) is created and assigned to the X224 layer before calling Connect().","Check the error returned by the transport dial step; if it failed, do not proceed to X224.Connect().","If the transport was closed, rebuild the whole stack (transport + X224) rather than reusing the instance.","Use the library's high-level client constructor instead of assembling X224 manually."],"exampleFix":"// before\nx224 := t125.NewX224(...)\nerr := x224.Connect() // transport never assigned\n// after\ntransport, err := core.NewTransport(conn)\nif err != nil {\n    return err\n}\nx224 := t125.NewX224(transport)\nerr = x224.Connect()","handlingStrategy":"validation","validationCode":"if x224 == nil || x224.transport == nil {\n    return errors.New(\"x224 transport must be set before Connect()\")\n}","typeGuard":null,"tryCatchPattern":"if err := x224.Connect(); err != nil {\n    if err.Error() == \"no transport\" {\n        return fmt.Errorf(\"protocol stack misconfigured: %w\", err)\n    }\n    return err\n}","preventionTips":["Always construct the protocol stack through the library's high-level client constructor","Check transport dial errors before handing the transport to X224","Never reuse an X224 instance after its transport was closed"],"tags":["rdp","x224","initialization","nil-transport"],"backgroundTag":"missing-required-argument","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}