5 Replies - 1188 Views - Last Post: 12 March 2013 - 11:56 AM Rate Topic: -----

#1 TomWrigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-March 13

Task manager says not responding

Posted 12 March 2013 - 07:37 AM

Hi all,

I'm relatively new to programming and picking it up as I go along. I've made a program as part of my dissertation that when run it creates a text document containing information about the user name, logon time, IP address and MAC address.

The program then takes a print screen every 12 mins and saves all these files locally with the file extension .blackbox.

The program is called Blackbox and is designed to run in the background when the user logs on, notify them that it is running and then monitor them. Its part of my dissertation about if any data is left behind by someone using Cloud Computing and if there is a way to monitor them.

So far the program can collect the data and do the print screens but when its running it shows up in the applications tab as 'not responding' as a program that is meant to be stealthy this is not a good thing :P

Any ideas from the code gurus?

Regards


Tom

Is This A Good Question/Topic? 0
  • +

Replies To: Task manager says not responding

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Task manager says not responding

Posted 12 March 2013 - 11:26 AM

OK, so which bit is it you're looking to solve, the "not responding" or the fact it shows in task manager?

In regards to not responding, that's a tricky one and could be a number of things and without seeing any code it's difficult to advise.

Obvious thing would be a tight loop without using DoEvents?

Do you see the same in TaskManager when you run the code in the IDE, if so, you should be able to pinpoint what's causing the problem?
Was This Post Helpful? 0
  • +
  • -

#3 TomWrigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-March 13

Re: Task manager says not responding

Posted 12 March 2013 - 11:33 AM

For the moment the "not responding", the program works as it should.

Imports System.Drawing
Imports System.Windows.Forms
Imports System.Net.NetworkInformation
Imports System.IO

Public Class Blackbox
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Public Sub Screenshot_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Hide()


        MsgBox("This is a notification to inform you that the network Administrator has placed this computer under Blackbox monitoring") 'NOTIFCATION FOR USER

        If (Not System.IO.Directory.Exists("C:\Blackbox\" & Environment.UserName & Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy") & "\screenshots")) Then 'MAKES THE FOLER WHERE TO SAVE THE PRINT SCREEN
            System.IO.Directory.CreateDirectory("C:\Blackbox\" & Environment.UserName & Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy") & "\screenshots")

        End If



        Try
            'CREATION OF TEXT DOCUMENT OF COMPUTER 
            Dim objStreamWriter As StreamWriter

            objStreamWriter = New StreamWriter("C:\Blackbox\" & Environment.UserName & Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy") & "\screenshots\" & Format(Now, "HH") & Format(Now, "mm") & ".blackboxdata") 'THE .BLACKBOXDATA EXTENTION IS TO DISCOURAGE USERS FROM PLAYING WITH IT. YOU NEED TO KNOW WHAT THE ORIGINAL FILE IS IN ORDER TO READ IT. JUST CHANGE THE EXTENTION TO .TXT
            objStreamWriter.Write("SYSTEM INFORMATION REGARDING THE LOGON USER")
            objStreamWriter.Write(" " + Environment.NewLine)
            objStreamWriter.Write(" " + Environment.NewLine)
            objStreamWriter.WriteLine("CURRENT PC IP ADDRESS")
            objStreamWriter.WriteLine(GetIPv4Address())
            objStreamWriter.Write(" " + Environment.NewLine)
            objStreamWriter.WriteLine("LOGON TIME AND DATE")
            objStreamWriter.WriteLine(Now())
            objStreamWriter.Write(" " + Environment.NewLine)
            objStreamWriter.WriteLine("THE USER THAT IS LOGGED ON")
            objStreamWriter.WriteLine(GetUserName())
            objStreamWriter.Write(" " + Environment.NewLine)
            objStreamWriter.WriteLine("MAC ADDRESS")
            objStreamWriter.WriteLine()

            For Each nic As System.Net.NetworkInformation.NetworkInterface In System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
                objStreamWriter.WriteLine(String.Format("The MAC address of {0} is{1}{2}", nic.Description, Environment.NewLine, nic.GetPhysicalAddress())) 'ADDS ALL MAC ADDRESSES TO THE TEXT DOCUMENT
            Next


            objStreamWriter.Close()


        Catch ex As Exception
            Console.Write(ex.ToString)

        End Try

        Dim bounds As Rectangle
        Dim screenshot As System.Drawing.Bitmap
        Dim graph As Graphics
        Dim Timer As Integer
        Dim Filename As String

        Filename = 0 'ADDED THE VALUE TO THE FILE NAME
        Timer = 1 'KEEPS THE LOOP RUNNING
        Do Until Timer = 2

            'TAKES THE PRINT SCREEN
            System.Threading.Thread.Sleep(200)
            bounds = Screen.PrimaryScreen.Bounds
            screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
            graph = Graphics.FromImage(screenshot)
            graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
            Me.Show()

            'SAVES THE PRINT SCREEN TO THE FOLDER LISTED

            screenshot.Save("C:\Blackbox\" & Environment.UserName & Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy") & "\screenshots\" & Format(Now, "HH") & Format(Now, "mm") & ".blackbox")

            Sleep(63000) 'Takes a picture evey 12 mins

        Loop
    End Sub

    Declare Function GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
ByRef nSize As Integer) As Integer


    Public Function GetUserName() As String
        Dim iReturn As Integer
        Dim userName As String
        userName = New String(CChar(" "), 50)
        iReturn = GetUserName(userName, 50)
        GetUserName = userName.Substring(0, userName.IndexOf(Chr(0)))


    End Function
    Private Function GetIPv4Address() As String
        GetIPv4Address = String.Empty
        Dim strHostName As String = System.Net.Dns.GetHostName()
        Dim iphe As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(strHostName)

        For Each ipheal As System.Net.IPAddress In iphe.AddressList
            If ipheal.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
                GetIPv4Address = ipheal.ToString()
            End If
        Next



    End Function




End Class


Here's what I've got. When I say I'm new to VB I mean learning as I go along sosorry if it seems a little iffy,
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9569
  • View blog
  • Posts: 36,233
  • Joined: 12-June 08

Re: Task manager says not responding

Posted 12 March 2013 - 11:42 AM

This is VB.NET, right? Not VB6?
Was This Post Helpful? 0
  • +
  • -

#5 TomWrigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-March 13

Re: Task manager says not responding

Posted 12 March 2013 - 11:45 AM

Ah. OK, I'm sorry, put here genuinely in error. I'll delete it and re-post it in the correct spot.
Was This Post Helpful? 0
  • +
  • -

#6 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Task manager says not responding

Posted 12 March 2013 - 11:56 AM

As Modi has said, it is VB.Net, but that being said, the line SLEEP(63000) would explain your "Not responding" issue.

Sleep causes the app to do just that.

Try using a Timer, as opposed to Sleep and put a call to your screenshot code in the timer event.

This post has been edited by maj3091: 12 March 2013 - 11:57 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1