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

Adding VNC Info #83

Open
wants to merge 1 commit into
base: onionscan-0.2
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good approach to me. Maybe adding a port number in here would make sense to prepare for protocols and ports to be decoupled more (#46)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Idea. Added.

Type string `json:"type"`
Port uint `json:"port:`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should json:"port: be 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})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having a try at porting over some other scans to this system and just noticed that osr.ProtocolInfoList is not initialized to an empty list, so it will be null instead of [] if nothing is found. Dunno if that's a problem.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. We should probably initialize this for consistency.

I'm still trying to work out the best approach here....given a proper database structure. I should have more of an idea soon - I would hold off on porting any of the other scans until then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just the the BitcoinService was already so similar, and it seems like an elegant approach. But I'll hold it off for now.

}

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