+ Post New Thread
Results 1 to 13 of 13
General Chat Thread, Two useful programs i've written in vb.net in General; Couldn't think of a title to use but basicly i've written two applications. The first is Away From Office which ...
  1. #1

    Join Date
    Oct 2006
    Posts
    146
    Thank Post
    1
    Thanked 13 Times in 7 Posts
    Rep Power
    32

    Two useful programs i've written in vb.net

    Couldn't think of a title to use but basicly i've written two applications.
    The first is Away From Office which allows you to set yourself to away which will leave a full screen message on your screen telling anyone who may stuble into your office that your away/how long for and where.

    It also allows you to log how much out of office time you've clocked that day...
    Wrote it purely to help others in the office to find me when I went walkabouts. Might be bugs but it works fine for me.

    The second application is used to find MAC addresses of all workstations on a domain, providing the workstations are switched on.
    This can be handy if you want to use WakeOnLan which is the purpose that I created it for.

    Anyway both attatched... Might be buggy but I can sort that. Requires .net framework 3 I think...
    Attached Files Attached Files

  2. 3 Thanks to flexyjerkov:

    elsiegee40 (1st July 2010), LosOjos (1st July 2010), nephilim (1st July 2010)

  3. #2

    elsiegee40's Avatar
    Join Date
    Jan 2007
    Location
    Kent
    Posts
    10,629
    Thank Post
    1,771
    Thanked 2,155 Times in 1,594 Posts
    Rep Power
    767
    Thanks will take a look at away from office one in particular, it could be very useful for me!

  4. #3

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,486
    Thank Post
    1,570
    Thanked 459 Times in 300 Posts
    Rep Power
    212
    Can I just say, what is the general opinion of code/exe being posted on the forum from unknown sources? No being funny but I think its a practice that needs some Mod/Admin clarification.

    Sorry flexyjerkov, don't want to take anything away from your contribution in any way

  5. #4

    Join Date
    Oct 2006
    Posts
    146
    Thank Post
    1
    Thanked 13 Times in 7 Posts
    Rep Power
    32
    Sure chr1s but I think on here the general idea is that if someones unsure then antivirus can be used. Here we scan we Sophos and I have no intentions on screwing my rep on here.

  6. #5

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,486
    Thank Post
    1,570
    Thanked 459 Times in 300 Posts
    Rep Power
    212
    Quote Originally Posted by flexyjerkov View Post
    Sure chr1s but I think on here the general idea is that if someones unsure then antivirus can be used. Here we scan we Sophos and I have no intentions on screwing my rep on here.
    It was more a general remark about code/exe being posted not a specific thing about yours.
    If its just code that mails out a list of MAC,IPs and open ports would a virus checker pick that sort of thing up?

  7. #6

    Join Date
    Oct 2006
    Posts
    146
    Thank Post
    1
    Thanked 13 Times in 7 Posts
    Rep Power
    32
    I guess your right there, and tbh its all down to trust and thats with any software.

  8. #7

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    he general idea is that if someones unsure then antivirus can be used.
    Doesn't work... for the most part (usable) AV is only good at detecting old malware... if I decided to post some superficially helpful util containing my very own secret malicious payload, you could be 100% certain I would have first checked that none of the major AV products had a problem with it.

    If its just code that mails out a list of MAC,IPs and open ports would a virus checker pick that sort of thing up?
    Because of all the spam-bots over the year some AV blocks outbound SMTP connections by default or can easily be configured to do that, so yes it might. But there are much subtler ways to get small amounts of valuable data out of networks.
    Last edited by PiqueABoo; 1st July 2010 at 07:07 PM.

  9. #8

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,432
    Thank Post
    1,432
    Thanked 1,160 Times in 794 Posts
    Rep Power
    705
    I think it's just about common sense. flexyjerkov has positive rep here, so I'd be willing to try out his software. If it was his first post or he had negative rep, I'd probably ignore it.

    @flexyjerkov: thanks for sharing

  10. #9

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    I'd be much happier if the source code was posted - I know many people won't be able to read it, won't understand it, won't know what to do with it and just want an EXE file they can run but I think it helps to develop ideas if others can chip in and say "Wow, that's a brilliant way of doing ...", "what about doing ..." or "OMG, why have you done ..."

    I think this is partly why I like scripting - you basically always distribute source code which people can use as they see fit.

  11. #10

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,673
    Thank Post
    3,205
    Thanked 1,029 Times in 954 Posts
    Rep Power
    361
    Quote Originally Posted by srochford View Post
    I'd be much happier if the source code was posted - I know many people won't be able to read it, won't understand it, won't know what to do with it and just want an EXE file they can run but I think it helps to develop ideas if others can chip in and say "Wow, that's a brilliant way of doing ...", "what about doing ..." or "OMG, why have you done ..."

    I think this is partly why I like scripting - you basically always distribute source code which people can use as they see fit.
    Which is why I have started liking hta's quite a bit that way you get the GUI ( maybe not as flash as an exe in dot net or anything like that ) but you can also as you stated view the source code via notepad or something like that ie notepad++ or wordpad or whatever your choice / preference is and you can use vb or java script in a hta as well as WMI ( obviously )


  12. #11

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,486
    Thank Post
    1,570
    Thanked 459 Times in 300 Posts
    Rep Power
    212
    Quote Originally Posted by PiqueABoo View Post
    But there are much subtler ways to get small amounts of valuable data out of networks.
    I must remember not to annoy you lol

  13. #12

    Join Date
    Oct 2006
    Posts
    146
    Thank Post
    1
    Thanked 13 Times in 7 Posts
    Rep Power
    32
    vb.net code for the MAC Address Searcher, The other application is easy enough to write yourself to havn't bothered with code.

    PS there might be problems with running the away one in resolutions other than 1280x1024 as I only set the popups form size to be 1280x1024 but that can be ammended.


    form1.vb

    Requires objects:
    timer: name: timer enabled: false intival: 1000
    textbox: name: txt_domain text: domain.name
    Button: name: btn_run text: run
    Button: name btn_quit text: quit
    Progress bar: name: bar
    Check boxes: chk_remove and chk_replace
    Label: lbl_addresses

    Code:
    Imports System
    Imports System.Threading
    
    Public Class Main
    
        Const intForReading = 1
        Const intForWriting = 2
        Const intForAppending = 8
        Dim objFSO = CreateObject("Scripting.FileSystemObject")
        Dim objFileSystem = CreateObject("Scripting.fileSystemObject")
        Dim inputdata, colitems, localaddress, localmacaddress, objcommand, objwmiservice, objinputfile, objfile, strInput, esttime, timeseconds
        Dim objitem, strrootdomain, strquery, stroutputfile, strdistinguishedname, strdata, strattributes, objrecordset, strComputer
        Dim loadbarvalue, loadbarcount, maccount As Integer
        Dim t As Thread
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                End Sub
    
        Private Sub CodeRun()
            On Error Resume Next
            'Delete & Create Lists & Start Value
            objFSO.DeleteFile("PCList.txt")
            objfile = objFSO.CreateTextFile("PCList.txt")
            objfile = objFSO.OpenTextFile("pclist.txt", 2, True)
            objfile.Writeline("Test")
            objfile.close()
            objfile = objFSO.OpenTextFile("MacAddresses.csv", 2, True)
            objfile.Writeline("MAC ADDRESS List")
            objfile.Close()
            If chk_replace.Checked = True Then
                objFSO.DeleteFile("Macaddresses.csv")
                objfile = objFSO.CreateTextFile("Macaddresses.csv")
                objfile.Writeline("MAC ADDRESS List")
                objfile.Close()
            Else
                If objFSO.FileExists("macaddresses.csv") Then
                Else
                    objfile = objFSO.CreateTextFile("Macaddresses.csv")
                End If
            End If
            loadbarcount = 0
            loadbarvalue = 0
            maccount = 0
            timeseconds = 0
    
            'Active Directory Code
            strrootdomain = txt_domain.Text
            objcommand = CreateObject("ADODB.Command")
            Dim objConnection = CreateObject("ADODB.Connection")
            objConnection.Provider = "ADsDSOObject"
            objConnection.Open = "Active Directory Provider"
            objcommand.ActiveConnection = objConnection
    
            'Retrieve attributes.
            strattributes = "sAMAccountName,distinguishedName"
    
            strquery = "<LDAP://" & strrootdomain _
            & ">;(ObjectCategory=computer);" & strattributes & ";subtree"
    
            objcommand.CommandText = strquery
            objrecordset = objcommand.Execute
    
            objfile = objFSO.OpenTextFile("pclist.txt", 2, True)
            Do Until objrecordset.EOF
                strComputer = objrecordset.Fields("sAMAccountName")
                strdistinguishedname = objrecordset.Fields("distinguishedName")
                objfile.Writeline(strComputer)
                objrecordset.MoveNext()
                loadbarcount = loadbarcount + 1
            Loop
            objfile.Close()
    
            System.Threading.Thread.Sleep(1000)
            bar.Maximum = loadbarcount
    
            'Mac Address Searchin
            stroutputfile = "PCLIST.txt"
            objinputfile = objFileSystem.OpenTextFile(stroutputfile, intForReading)
    
            'read everything in an array
            inputdata = Split(objinputfile.ReadAll, vbNewLine)
            For Each strdata In inputdata
                strComputer = strdata
                localmacaddress = ""
                objitem.macaddress = ""
                colitems = ""
                objwmiservice = ""
                colitems = ""
                'Check Computers Mac Address
                strComputer = Replace(strComputer, "$", "", 1, -1, vbTextCompare)
                objwmiservice = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
                colitems = objwmiservice.ExecQuery _
                ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    
                objfile = objFSO.OpenTextFile("MacAddresses.csv", 8, True)
                For Each objitem In colitems
                    localmacaddress = objitem.macaddress
                Next
    
                'Convert Mac Address And Write To File If Exists
                If localmacaddress = "" Then
                Else
                    maccount = maccount + 1
                    If chk_remove.Checked = True Then
                        localmacaddress = Replace(localmacaddress, ":", "", 1, -1, vbTextCompare)
                        objfile.Writeline(localmacaddress)
                    End If
                End If
                objfile.close()
                loadbarvalue = loadbarvalue + 1
            Next
            timer.Enabled = False
            MsgBox("List Generated: MacAddresses.csv" & vbCrLf & "Mac Addresses Found: " & maccount)
            btn_run.Text = "Run"
            txt_domain.Enabled = True
            chk_remove.Enabled = True
            chk_replace.Enabled = True
            objfile.Close()
            objfile = objFSO.OpenTextFile("macaddresses.csv", 1, True)
            objfile.Close()
            objfile = objFSO.OpenTextFile("pclist.txt", 1, True)
            objfile.close()
        End Sub
    
        Private Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer.Tick
            bar.Value = loadbarvalue
            esttime = DateAdd("s", timeseconds, #12:00:00 AM#)
            lbl_addresses.Text = ("MAC Addresses Found: " & maccount & vbCrLf & "AD Records Found: " & loadbarcount & vbCrLf & "Time Elapsed: " & esttime)
            timeseconds = timeseconds + 1
        End Sub
    
        Private Sub btn_run_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_run.Click
            If btn_run.Text = "Run" Then
                If txt_domain.Text = "DOMAIN.NAME" Then
                    MsgBox("Enter Domain Name", vbCritical, "Error")
                ElseIf txt_domain.Text = "" Then
                    MsgBox("Enter Domain Name", vbCritical, "Error")
                Else
                    timer.Enabled = True
                    txt_domain.Enabled = False
                    t = New Thread(AddressOf Me.CodeRun)
                    t.Start()
                    chk_remove.Enabled = False
                    chk_replace.Enabled = False
                End If
                btn_run.Text = "Stop"
            Else
                timer.Enabled = False
                t.Abort()
                btn_run.Text = "Run"
                txt_domain.Enabled = True
                MsgBox("List Generated: MacAddresses.csv" & vbCrLf & "Mac Addresses Found: " & maccount)
                chk_remove.Enabled = True
                chk_replace.Enabled = True
                objfile.Close()
                objfile = objFSO.OpenTextFile("macaddresses.csv", 1, True)
                objfile.Close()
                objfile = objFSO.OpenTextFile("pclist.txt", 1, True)
                objfile.close()
            End If
    
        End Sub
    
        Private Sub btn_quit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_quit.Click
            t = New Thread(AddressOf Me.CodeRun)
            t.Abort()
            Me.Close()
        End Sub
    
    End Class

  14. #13

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    I must remember not to annoy you lol
    Excellent idea, don't forget and tell everyone else whilst you're remembering.

    I've never broken into anything without authority: Long since had one those 'defining experiences' where I was literally a carriage return away from stepping over to the 'dark side', but having spent a day making/testing the devious vengeful consequences of that key press[1] (which were definitely going to work) I decided life would just be easier if I didn't do stuff like that.

    [1] For an online casino on some island tax haven probably owned by some minor organised crime bunch that had paid some spammer who happened(?) to forge my e-mail address into a seriously high volume spam sent on their behalf. As a consequence I got an exploded mailbox with zillions of bounces and a lot of "hand-written" responses of various flavours - largely threats, outrage, but just a few that made me sad and hence vengeful.

SHARE:
+ Post New Thread

Similar Threads

  1. Tip:: WHM transfer : files get written blank?
    By contink in forum Web Development
    Replies: 0
    Last Post: 24th September 2008, 09:59 PM
  2. [Joke] This was written by a guy... it's pretty damn smart
    By Shane in forum Jokes/Interweb Things
    Replies: 2
    Last Post: 14th May 2008, 12:59 PM
  3. Job Interview - Practical / Written tests
    By googlemad in forum General Chat
    Replies: 18
    Last Post: 25th February 2007, 03:26 PM
  4. Help! Written technical test task
    By goofy in forum Educational IT Jobs
    Replies: 4
    Last Post: 20th August 2006, 12:02 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •