Skip to content

Commit

Permalink
Extract Desktop name and size from VNC Sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
s-rah committed Oct 7, 2016
1 parent 715141f commit 194e6fb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
26 changes: 25 additions & 1 deletion protocol/vnc_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import (
"github.com/s-rah/onionscan/config"
"github.com/s-rah/onionscan/report"
"github.com/s-rah/onionscan/utils"
"github.com/mitchellh/go-vnc"
)

type VNCProtocolScanner struct {
}

type VNCInfo struct {
DesktopName string
Width uint16
Height uint16
Error string
}

func (vncps *VNCProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport) {
// MongoDB
osc.LogInfo(fmt.Sprintf("Checking %s VNC(5900)\n", hiddenService))
Expand All @@ -19,8 +27,24 @@ func (vncps *VNCProtocolScanner) ScanProtocol(hiddenService string, osc *config.
report.VNCDetected = false
} else {
osc.LogInfo("Detected possible VNC instance\n")
// TODO: Actual Analysis

report.VNCDetected = true
config :=new(vnc.ClientConfig)
ms := make(chan vnc.ServerMessage)
config.ServerMessageCh = ms
vc, err := vnc.Client(conn, config)
vncinfo := new(VNCInfo)
if err == nil {
osc.LogInfo(fmt.Sprintf("VNC Desktop Detected: %s %s (%v x %v)\n", hiddenService, vc.DesktopName, vc.FrameBufferWidth, vc.FrameBufferHeight))
vncinfo.DesktopName = vc.DesktopName
vncinfo.Width = vc.FrameBufferWidth
vncinfo.Height = vc.FrameBufferHeight
} else {
osc.LogError(err)
vncinfo.Error = err.Error()
}
report.AddProtocolInfo("vnc", vncinfo)

}
if conn != nil {
conn.Close()
Expand Down
15 changes: 13 additions & 2 deletions report/onionscanreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,20 @@ type OnionScanReport struct {
// SMTP
SMTPFingerprint string `json:"smtpFingerprint"`
SMTPBanner string `json:"smtpBanner"`


ProtocolInfoList []ProtocolInfo `json::"protocolInfoList"`

NextAction string `json:"lastAction"`
TimedOut bool
TimedOut bool `json:"timedOut"`
}

type ProtocolInfo struct {
Type string `json:"type"`
Info interface{} `json:"info"`
}

func (osr *OnionScanReport) AddProtocolInfo(protocolType string, protocolInfo interface{}) {
osr.ProtocolInfoList = append(osr.ProtocolInfoList, ProtocolInfo{protocolType, protocolInfo})
}

func LoadReportFromFile(filename string) (OnionScanReport, error) {
Expand Down

0 comments on commit 194e6fb

Please sign in to comment.