We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,459 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Backtrack Terminal in Visual basic

To be honest, I tried to find a tittle for this but i couldn't think of any
I'm creating an application using visual basic 2010 that i will be using/running on Backtrack 5 R3, I tried it and it works fine, But i needed to add a Terminal to the application, Instead of opening Terminal on backtrack, I want to have it built in my application
Any idea guys how to do that?
thanks :)
This is the code that i had to add windows Command "CMD", But this works with Windows ONLY
>
>
>

ublic Class Form1
    Private WithEvents MyProcess As Process
    Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Width = 488
        Me.AcceptButton = Button1
        MyProcess = New Process
        With MyProcess.StartInfo
            .FileName = "CMD.EXE"
            .UseShellExecute = False
            .CreateNoWindow = True
            .RedirectStandardInput = True
            .RedirectStandardOutput = True
            .RedirectStandardError = True
        End With
        MyProcess.Start()
        MyProcess.BeginErrorReadLine()      'start async read on stderr
        MyProcess.BeginOutputReadLine()     'start async read on stdout
        AppendOutputText("Process Started at: " & MyProcess.StartTime.ToString)
    End Sub
    Private Sub MyProcess_ErrorDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles MyProcess.ErrorDataReceived
        AppendOutputText(vbCrLf & "Error: " & e.Data)
    End Sub

    Private Sub MyProcess_OutputDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles MyProcess.OutputDataReceived
        AppendOutputText(vbCrLf & e.Data)
    End Sub

    Private Sub AppendOutputText(ByVal text As String)
        If OutputTextBox.InvokeRequired Then
            Dim myDelegate As New AppendOutputTextDelegate(AddressOf AppendOutputText)
            Me.Invoke(myDelegate, text)
        Else
            OutputTextBox.AppendText(text)
        End If
    End Sub
    'button1 coding
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MyProcess.StandardInput.WriteLine(InputTextBox.Text)
        MyProcess.StandardInput.Flush()
    End Sub
End Class
4
Contributors
15
Replies
3 Months
Discussion Span
1 Month Ago
Last Updated
25
Views
Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

not sure if this will work for you but the code in this post does create a generic console in a forms application. Basically you have a form and a terminal. The terminal works via the Console class. It's in c# but I just compiled it as a Class Library and imported the resulting .dll into a vb app. Careful the original code is missing some using statements but they're itemized in a following post

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

Thanks tinstaafl for your respond
I do have the C# too, But what i have seen/Understood from the "Post/Link" you added with your reply was kind of talking about windows, Im not actually good at programming, And if im mistaken, Please correct me, what i needed is like adding the Backtrack5 terminal into my application, So i can use the terminal just from my application
Please help because i couldn't find any sign/solution for it online :(
thanks again

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Something to do with for example 2 textboxes, One will be the input and the second one will be the output, What ever you will type in the input>> will come up on the output just like using the Terminal Command

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

It sounds like, in order to run your app on BasckTrack you must have a wrapper to interpret the code. Unless that wrapper has a library that you can access I don't think there's a simple way to do what you ask.

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

Do you recommend any good tittle to help me find it please
Thanks for your time :)

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Sorry without knowing the exact details of how you're running a windows app on a linux OS, it would be very difficult to even suggest where to look.

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

Ok, I'm aiming to develop an application in Visual basic or C# that will be having like a Textbox1 in the form1, And this application will be used as you are using the "backtrack5 Terminal-Command lne" and run it on Backtrack
the above coding that i posted is to add the windows CMD 'command' in your application, But that to be used on Windows only, It actually have got two textboxes, The inpout and the output
Now wanted to do the same as i did with the windows CMD, But with Backtrack terminal comman line built in it too so it can work on the backtrack
To run an .EXE file on backtrack, i have to use the MONO 2.10.8 for windows
I have tried to use the windows CMD on backtrack5, But it doesn't do the same job as the backtrack terminal command line
I apologise if im making it even more complicated, Because my english isn't good enough to explain it in a higher level as i'm actually new to programming
Thanks a lot :)

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Did you try my earlier post about a generic terminal? Because it's not tied to a specific windows shell, like CMD, you may have more luck. Also I took a look at the Mono website. They have a gresat many options there for interfacing .net apps to linux. This sound like the best place to find out whether what you want to do is possible

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

Hi tinstaafl, I did actually tried the codes you gave me in the (Post) link, But it didn't work, I will be really really pleased if you could make a project for me send it to me please if that won't waste your time or take a long time to get it done
I have atually looked every where, But i couldn't find the solution for it and i really need it
Thanks for all your replays and helps :)

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

That wouldn't really be practical as I don't have a linux system to test it on. I think though that using the Mono api would still be your best bet. Instead of using it to run your windows code, try using it to cross compile your code for linux.

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

And how to do that please comppile the code for linux ?

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

You'll have to check the docs for Mono API

tinstaafl
Nearly a Posting Virtuoso
1,336 posts since Jun 2010
Reputation Points: 360
Solved Threads: 235
Skill Endorsements: 14

Careful the original code is missing some using statements but they're itemized in a following post

Seacanoeist
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

hi
this is hard code for backtrack terminal in visual basic.

markstylor
Newbie Poster
3 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

is any any chance to get it done in C or C++ or programming language that i can use on Windows ?
I have been looking for it and i couldn't find it at all :S

Matigo
Light Poster
41 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1154 seconds using 2.76MB