Tuesday, February 21, 2012

Disable Solidcore


Running solidcore you may run into a problem where you have to disable it with out using epo or the local CLI

Here are the steps.

Step 1.
Boot computer into Safe Mode(Press F5 before windows boot screen)
Step 2.
Open Registry (Start->Run->regedit)
Step 3.
Navigate to:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\swin\Parameters]
Step 4.
Double-click DWORD RTEMode and change value to 0
Double-click DWORD RTEModeOnReboot and change value to 0


Reboot the computer and the agent should now be disabled.
Note:
Doing this will send out alerts to the central server.

Thursday, February 2, 2012

Excel document for pinging list of computers VBA

Here is an excel document I created that will ping a list of nodes in column A and give results in column B. There are much better tools that can be used such as angry ip scanner http://www.angryip.org/w/Home. I just wrote this as an example



Requirements:
Tested with Office 2010

Download:
Download

Monday, January 23, 2012

Howto: Two different subnets same physical LAN how to get them to talk without a gateway

Have you ever ran into a problem where you had two windows boxes that were on different sub nets on the same physical LAN and you needed to establish temporarily communication?

Say you have these two computers with the following ip addresses.

Computer 1
172.16.1.2 

Computer 2
192.168.100.1



So what we are going to do is tell each computer that in order to get to the other computer they have to go out their local interface.

Open a command prompt and run each of the following commands on the respective computer.

Computer 1
route add 192.168.100.1 MASK 255.255.255.255 172.16.1.2

Computer 2
route add  172.16.1.2  MASK 255.255.255.255 192.168.100.1


This now should allow for communication to occur.

I wrote a batch file to help with adding the route command


@echo off
echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Echo Created By Tony Unger
Echo **********************************************************************
echo Note:

echo Setup Routing Table
Echo Enter IP address you wish to connect to
REM IP address that was entered
set /p IPAddress=

REM Find Local IP Address - Works for Win7 if you have more then 1 adapter this may not work

REM Windows 7
FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG ^| FIND "IPv4"') DO FOR %%B IN (%%A) DO SET LOCIPADDR=%%B


route add %IPAddress% MASK 255.255.255.255 %LOCIPADDR% /p






Tuesday, January 17, 2012


ATTR attributes for Solidcore 5

These are not listed in the documentation I had to get this information from development.


Attr command can be used to configured the required files to behave corresponding the solidifier.

-a  Always authorized attribute
     This attribute allows the user to configure a supported file as always authorized to execute.
      File configured under this attribute will be allowed to execute whether solidified or not.


-b  Bypassed from memory control attribute
      This attribute allows user to configure a process to run bypassed from MP-mangking and MP-decoying.
      This is one of the memory protection technique provided by solidifier but it is disabled by default.


-c  Bypassed from Critical Address Space Protection attribute
     Critical Address Space Protection is the latest and most effective memory protection technique provided by Solidifier. It is enabled by default.


     -c attribute configures a process to run bypassed from MP-CASP.


-d  Bypassed from process stack randomization attribute

    This comes under MP-VASR which is enabled only on special request from customer.


-e  Rebase dll attribute
    Changing the base address of the dll.


-r  Bypassed from dll relocation attribute
     -d, -e and -r attributes belong to VASR memory protection technique. This feature is disabled by default as CASP
     is enabled.


-f  Full crawl attribute
     -f attribute belongs the MP-mangling and MP-decoying memory protection. This feature is disable by default.
 
-i  Bypassed from installer detection attribute
    -i belongs to pkg-ctrl feature which tracks for the installation and uninstallation of MSI based packages...


-u  Always unauthorized attribute
    block the file from execution even if solidified.

-o  Process Context registry bypass:

Solidifier will not track any registry operations for the process configured under this attribute. All the registry operations in context of the configured process will be bypassed from solidifier.


-n Bypassed from DEP:
DEP is the Data Execution Prevention provided by Solidifier for 64-bit Machines. It is  a Memory protection technique provided by solidifier for 64 bit machines.Memory protection check will not apply  on the process configured as ‘Bypassed from DEP’.

-l Anti-Debugging Bypass:


Anti-debugging feature is there to prevent any process to access Memory space of the solidifier product. This is usually done by the debuggers to debug the application.

Any process bypassed from Anti-debugging  feature shall be able to access the solidifier address space in the kernel.

-p Process Context File Operations Bypass

Solidifier will not track any file operations for the process configured under this attribute. All the file operations in context of the configured process will be bypassed from solidifier.

Wednesday, January 11, 2012



Runas Touch Screen Application
















Purpose:
One of the problems I had at work was the ability to run an application as a different user on a touch screen computer. So I wrote an application that dynamically creates buttons based on what it reads from a text file called paths.txt. This program does support arguments and should be able to figure out how to break up the path to find them.

To install just extract the application and paths.txt to a folder and runas away.

Requirements:
.net 4 framework
osk.exe in the usual place if you want to use the onscreen keyboard

TODO:
Add some more error checking with reading the text file
Clean code
Maybe allow this to work with domain user if someone wants.



Paths.txt 

name,path
------------------------------------------------------------------------------
Add\Remove Programs,rundll32.exe shell32.dll,Control_RunDLL Appwiz.cpl
Command Prompt,C:\Windows\System32\cmd.exe
Datetime,rundll32.exe shell32.dll,Control_RunDLL TimeDate.cpl
Display Properties,rundll32.exe shell32.dll,Control_RunDLL Desk.cpl
Notepad,C:\Windows\Notepad.exe
System Properties,rundll32.exe shell32.dll,Control_RunDLL Sysdm.cpl
Taskmgr,taskmgr
Control Panel,rundll32.exe shell32.dll,Control_RunDLL
------------------------------------------------------------------------------

Download Link: 
RunasUserTS.zip

Source code:
Leave a message and I will work on uploading the source

Tuesday, November 22, 2011


This is an example of a vb.net 2010 console application i wrote to send emails off an open relay.


Imports System.Net.Mail

Module Module1

    Sub Main()
        'Arguments
        Dim inputArgumentEmailto As String = "/emailto="
        Dim inputArgumentSubject As String = "/subject="
        Dim inputArgumentSMTP As String = "/smtp="
        Dim inputArgumentBody As String = "/body="
        Dim inputArgumentEmailFrom As String = "/emailfrom="
        Dim inputArgumentQuestion As String = "/?"

        '  Dim inputQuestion As String = ""
        Dim inputEmailto As String = ""
        Dim inputSubject As String = ""
        Dim inputSMTP As String = ""
        Dim inputBody As String = ""
        Dim inputEmailFrom As String = ""

        Dim strTestArgs As Boolean
     
     

        For Each s As String In My.Application.CommandLineArgs

            If s.ToLower.StartsWith(inputArgumentQuestion) Then
                ' if /? is an argument then post help

                Console.WriteLine("Email Application")
                Console.WriteLine("Created by Tony Unger 11/22/2011")
                Console.WriteLine("Ver. 1.0")
                Console.WriteLine("This requires an open relay")
                Console.WriteLine("------------------------------")
                Console.WriteLine("Parameters")
                Console.WriteLine("")
                Console.WriteLine("/emailto=")
                Console.WriteLine("/subject=")
                Console.WriteLine("/smtp=")
                Console.WriteLine("/body=")
                Console.WriteLine("/emailfrom=")
                Console.WriteLine("")
                Console.WriteLine("Example:")
                Console.WriteLine("/emailto=toTony@asdf.com")
                Console.WriteLine("/subject=**Alert")
                Console.WriteLine("/smtp=192.168.1.1")
                Console.WriteLine("/emailfrom=FromTony@asdf.com")
                Console.WriteLine("/body=body")
                Console.WriteLine(" ""/body=This is an alert"" ")

                Exit Sub

            End If

            'Sets arg to string values
            If s.ToLower.StartsWith(inputArgumentEmailto) Then
                inputEmailto = s.Remove(0, inputArgumentEmailto.Length)
            End If

            If s.ToLower.StartsWith(inputArgumentSubject) Then
                inputSubject = s.Remove(0, inputArgumentSubject.Length)
            End If

            If s.ToLower.StartsWith(inputArgumentSMTP) Then
                inputSMTP = s.Remove(0, inputArgumentSMTP.Length)
            End If

            If s.ToLower.StartsWith(inputArgumentBody) Then
                inputBody = s.Remove(0, inputArgumentBody.Length)
            End If

            If s.ToLower.StartsWith(inputArgumentEmailFrom) Then
                inputEmailFrom = s.Remove(0, inputArgumentEmailFrom.Length)
            End If

        Next

        'Checks if all args are there
        If inputEmailto = "" Then
            Console.WriteLine("/emailto= is required")
            strTestArgs = True
        End If
        If inputSubject = "" Then
            Console.WriteLine("/subject= is required")
            strTestArgs = True
        End If
        If inputSMTP = "" Then
            Console.WriteLine("/smtp= is required")
            strTestArgs = True
        End If
        If inputBody = "" Then
            Console.WriteLine("/body= is required")
            strTestArgs = True
        End If
        If inputEmailFrom = "" Then
            Console.WriteLine("/emailfrom= is required")
            strTestArgs = True
        End If


        ' If any args are missing exit sub
        If strTestArgs = True Then
            Exit Sub
        End If
        'Email
        EmailtoSupport(inputEmailto, inputSubject, inputSMTP, inputBody, inputEmailFrom)
    End Sub

    Public Sub EmailtoSupport(inputEmailto As String, inputSubject As String, inputSMTP As String, inputBody As String, inputEmailFrom As String)


        Try
            Dim Mail As New MailMessage
            Mail.Subject = inputSubject
            Mail.To.Add(inputEmailto)
            Mail.From = New MailAddress(inputEmailFrom)
            Mail.Body = inputBody

            Dim SMTP As New SmtpClient(inputSMTP)
            SMTP.Port = "25"
            SMTP.Send(Mail)
            Console.WriteLine("Email Sent!")

        Catch ex As Exception
            If ex.Message.ToString = "Failure sending mail." Then
                Console.WriteLine("There was a failure sending the email.")
                Console.WriteLine("check your smtp address")
                Console.WriteLine("This program will only use port 25")
            Else
                Console.WriteLine(ex.Message.ToString)
            End If

        End Try
    End Sub

End Module

Monday, November 14, 2011

Batch file to start performance counters on system startup

Requirements:
Create folder on the c: drive
c:\perflogs\
Download
7-Zip
http://www.7-zip.org/download.html
copy 7za.exe to c:\perflogs
open perfmon and create the counters you wish to use
Add each counter name you created to the batch code under
:logmans in this format logman start countername




Create a schedule task that will run the created batch file at system startup
On reboot all csv files will be added to a zip file called performance{date}.zip
Then performance counters will be started.

REM Tony Unger
REM 8/26/2011
REM Initial Release 1.0
REM This batch file that compress all file in the c:\perflog directory to
performance%date:~4,2%%date:~7,2%%date:~10,4%.zip then purges all the old entries
rem then it starts the performance log again
7za.exe a -tzip c:\perflogs\performance%date:~4,2%%date:~7,2%%date:~10,4%.zip c:\perflogs\*.csv
if exist c:\perflogs\performance%date:~4,2%%date:~7,2%%date:~10,4%.zip goto PurgeOldRecords
:Exit
exit
:PurgeOldRecords
del *.blg
del *.csv
goto logmans
:logmans
logman start DiskSpace
logman start Memory
logman start CPU
logman start SQLMemory
go to exit

Powershell: Microsoft Graph to add new roles to application registration

PowerShell Script Bulk add new roles to application registration in azure. Update $roles with ,Us...