Jump to content

Recommended Posts

Posted

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...

  • Thanks 3
Posted

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 :)

Posted
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. :)
Posted
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?

Posted (edited)
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.

Edited by PiqueABoo
Posted

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 :)

Posted

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.

Posted
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 )

 

:)

Posted
But there are much subtler ways to get small amounts of valuable data out of networks.

 

I must remember not to annoy you lol ;)

Posted

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

 

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 = "        & ">;(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

Posted
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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...