Posts

Impacket-master - psexec for linux

I have an application that need to execute remote commands on Windows and linux. This app run in a CentOS server. It is easy to execute a remote on linux, but on Windows I had to search a good solution and I had find Impacket-master. To use this solution you have to follow this steps: Install python in your linux; Download this libraries; argparse-master - https://pypi.python.org/pypi/argparse   pyasn1 - https://pypi.python.org/pypi/pyasn1   pycrypto-2.6.1 - https://pypi.python.org/pypi/pycrypto Install Libraries; Unpack files: tar -vzxf pyasn1-0.1.9.tar.gz Install: python setup.py install  After this, install Ipacket-Master: python setup.py install You can find psexec.py in examples folder: impacket-master/examples These is a command line with an example: python psexec.py domain/user:password@server 'cmd /c "dir /s c:\"'

Windows - Open exe, bat and all other program files from your intranet

It is common to have a lot of shortcuts to our systems on the intranet. It is easy to publish web applications but it is hard to put together all desktops programs. To make easy this task you have to to 3 steps: 1 - Create a batch file and put this in a share which everybody has access; 2 - Add in your Windows desktops a registry file, this file will contain an URI definition that will make possible the workstations understand what to do with the instruction from html link. 3 - Create a link in your intranet, or create a HTML file with a link to test. 1 - Batch file: create a batch file like this example. for /F "tokens=2 delims=: " %%a in ("%1%") do ( rem this step will get the program from instruction set startProgram=%%a ) rem this step will replace / for \ set htmlProgram=%startProgram:/=\% start %startProgram% 2 - Windows registry: Create a .reg file with a text like this example. Windows Registry Editor Version 5.00 [HKEY...

Firebird - List last command from each connection

You can do this with this select: select  MON$SERVER_PID as PID, a.MON$REMOTE_ADDRESS as IP, a.MON$REMOTE_PROCESS as Program, MON$PAGE_READS as DiskRead, MON$PAGE_WRITES as DiskWriters, s.MON$SQL_TEXT as SQL from MON$ATTACHMENTS a, MON$IO_STATS i, MON$STATEMENTS s where  a.MON$STAT_ID = i.MON$STAT_ID  and a.MON$ATTACHMENT_ID = s.MON$ATTACHMENT_ID order by   MON$PAGE_READS desc

Active directory - Import data from CSV file

You can use the powershell script below to import data from a CSV file to your Active Directory. This example importa the department property from file. Import-Module ActiveDirectory $users = import-csv c:\temp\data.csv foreach ( $user in $ users ){ Set-ADUser $ user . samaccountname -Department $ user . department } CSV file example samaccountname,department username1,departament1

Windows - Install .NET using command line

Sometimes you need to install .NET 3.5 or 4 using the graphical interface and gets an error. For .NET 3 you can use this command, do not forget to change the path for your media folder. Dism /online /enable-feature /featurename:NetFx3 /All /Source:"f:\sources\sxs" /LimitAccess This is example to install .NET 4 online. DISM.exe /Online /enable-feature /featurename:NetFx4 /all Just change the parameters to install .NET 3.5 online or .NET 4 using media.

Openedge (Progress) - BI reads and writes (version 2)

We know that sometimes is hard to infentify who is making BI growing up. With the select below you can see the username, IP address and another informations about the process who is making BI bigger than the normal size. select     database() as Database,                u."_UserIO-Name" as 'User',                u."_UserIO-BiWrite" as 'Writes',                u."_UserIO-BIRead" as 'Reads',                c."_Connect-Time" as 'Connection date',                t."_Trans-txtime" as 'Transaction date',                t."_Trans-Duration" as 'Seconds',                c."_Connect-IPAddress" as 'IP',                c."_Connect-Pid" as 'PID OS...

Openedge (Progress) - List tables with more reads, inserts, updates and deletes since database start

With the script below you can get all this information. Just change the order by the get update, insert or delete instead reads. select top 10     database() as 'Database',       f."_File-Name" as 'Table',       t."_TableStat-read" as 'Read',       t."_TableStat-update" as 'Update',       t."_TableStat-create" as 'Insert',       t."_TableStat-delete" as 'Delete' from PUB."_TableStat" t, PUB."_File" f where f."_File-Number" = t."_tablestat-id" order by 3 desc