Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Some maybe usefull snippets

Found these while sorting my Harddrive:

GetAVInformation() - Gets the installed AVs name.
Code
Public Function GetAVInformation(ByVal strSystem As String) As String
        Dim strComputer As String = String.Empty
        Dim wmiNS As String = String.Empty
        Dim wmiQuery As String = String.Empty
        Dim objWMIService As Object
        Dim ColItems As Object
        Dim objItem As Object
        Dim str58 As New System.Text.StringBuilder
        Try
            If strSystem = System.Environment.MachineName Then
                strComputer = "."
            Else
                strComputer = strSystem
            End If
            wmiNS = "\root\SecurityCenter2" 'Windows XP SecurityCenter
            wmiQuery = "Select * from AntiVirusProduct"
            objWMIService = Microsoft.VisualBasic.GetObject("winmgmts:\\" & strComputer & wmiNS)
            ColItems = objWMIService.ExecQuery(wmiQuery)
            For Each objItem In ColItems
                Try
                    str58.AppendLine(objItem.displayname.ToString)
                Catch ex As System.Exception
                    str58.AppendLine("??" & Microsoft.VisualBasic.vbTab & Microsoft.VisualBasic.vbTab & Microsoft.VisualBasic.vbTab & "??")
                End Try
            Next
        Catch ex As System.Exception

        End Try
        'Log("AV is " + str58.ToString)
        Return str58.ToString
    End Function

GetSoftware() - Gets all installed Programs.
Code
Public Function GetSoftware() As String
        
Dim DestKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
        GetSoftware = ""

Dim value as String = ""
        For Each App As String In Microsoft.Win32.Registry.LocalMachine.OpenSubKey(DestKey).GetSubKeyNames

value = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(DestKey & App & "\").GetValue("DisplayName")

    if value <> "" then
            GetSoftware += "NewBlock-.-.-.-" & value
    end if
        Next
        Return GetSoftware

    End Function
[Image: uzpE9zW.jpg]

Can you put how to use this one ? :) Thanks in advance
Put them in your code and call the functions

Code
Dim AVInfo as String = GetAVInformation()
Dim Software as String = GetSoftware()

BUT GetSoftware gives a String in the following format: "SoftwarenameNewBlock-.-.-.-SoftwarenameNewBlock-.-.-.-"
So you have to split the string into a Stringarray.
Delimiter = NewBlock-.-.-.-

It's bad code I know but as I said I found them on my Harddrive :)
[Image: uzpE9zW.jpg]

There's is no bad code sir .
BTW Thanks for this
(Dec 5, 2014 09:45 PM)imi-tat0r Wrote:  BUT GetSoftware gives a String in the following format: "SoftwarenameNewBlock-.-.-.-SoftwarenameNewBlock-.-.-.-"
So you have to split the string into a Stringarray.
Delimiter = NewBlock-.-.-.-

You're appending the string with each new block... Just feed them into an array to begin with.
(Dec 6, 2014 06:00 AM)Odus Wrote:  You're appending the string with each new block... Just feed them into an array to begin with.

As I said this is bad code and I just found them on my Harddrive. I did not code this
[Image: uzpE9zW.jpg]



Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by SIM-5432905Nov 16, 2023 04:06 PM 8 285 Nov 16, 2023 04:06 PM
Last Post: Hackers
[Shell] by sam021Feb 5, 2019 01:59 AM 3 320 Feb 5, 2019 01:59 AM
Last Post: sam021
[.NET] by XoggOct 4, 2017 10:05 PM 31 2,059 Oct 4, 2017 10:05 PM
Last Post: Xogg