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 8333fe7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
26 changes: 25 additions & 1 deletion protocol/vnc_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package protocol

import (
"fmt"
"github.com/mitchellh/go-vnc"
"github.com/s-rah/onionscan/config"
"github.com/s-rah/onionscan/report"
"github.com/s-rah/onionscan/utils"
Expand All @@ -10,6 +11,13 @@ import (
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", 5900, vncinfo)

}
if conn != nil {
conn.Close()
Expand Down
14 changes: 13 additions & 1 deletion report/onionscanreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,20 @@ type OnionScanReport struct {
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"`
Port uint `json:"port:`
Info interface{} `json:"info"`
}

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

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

0 comments on commit 8333fe7

Please sign in to comment.