Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Desktop name and size from VNC Sessions #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 25 additions & 1 deletion protocol/vnc_scanner.go
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
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