Friday, April 21, 2017

Manipulate WMI through Perl

Online Library:


Inquery Tool:


An example of manipulating WMI through Perl
--------------------------------------------
#!/usr/bin/perl -w
#use strict;
#Execute a command:
#wmic /node:remote_computer process call create "netstat.exe -ano"
use Win32::OLE;
$|=1;

print("Target IP: ");
$target=<STDIN>;
chop($target);

#my ( $ServiceSet, $Service );

eval { $NetworkAdapters = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\".$target."\\Root\\CIMv2")->ExecQuery("SELECT * FROM Win32_NetworkAdapter"); };
unless($@){
                print "\n";
                foreach $Adapter (in $NetworkAdapters){
                                print $Adapter->{Name}, "\n";
                                print $Adapter->{Description}, "\n";
                }
}else{
                print STDERR Win32::OLE->LastError, "\n";
}
--------------------------------------------
 

Install Snort in Kali through Source Code on 20170421

#cd /usr/local/sbin
#wget http://www.tcpdump.org/release/libpcap-1.8.1.tar.gz
#tar -zxvf ./libpcap-1.8.1.tar.gz
#cd libpcap-1.8.1
#./configure && make && make install
#cd /usr/local/sbin
#wget https://www.snort.org/downloads/snort/daq-2.0.6.tar.gz
#wget https://www.snort.org/downloads/snort/snort-2.9.9.0.tar.gz
#tar -zxvf ./daq-2.0.6.tar.gz
#cd daq-2.0.6
#./configure --with-libpcap-includes=/usr/local/sbin/libpcap-1.8.1 --with-libpcap-libraries=/usr/local/sbin/libpcap-1.8.1
#make && make install
#cd /usr/local/sbin
#wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
#tar -zxvf ./pcre-8.40.tar.gz
#cd pcre-8.40
#./configure
#make && make install
#cd /usr/local/sbin
#wget https://cytranet.dl.sourceforge.net/project/libdnet/libdnet/libdnet-1.11/libdnet-1.11.tar.gz
#tar -zxvf ./libdnet-1.11.tar.gz
#cd libdnet-1.11
#./configure
#make && make install
#cd /usr/local/sbin
#wget http://www.zlib.net/zlib-1.2.11.tar.gz
#tar -zxvf ./zlib-1.2.11.tar.gz
#cd zlib-1.2.11
#./configure && make && make install
#cd /usr/local/sbin
#tar -zxvf ./snort-2.9.9.0.tar.gz
#cd snort-2.9.9.0
#./configure --enable-flexresp3 --enable-sourcefire --with-dnet-includes=/usr/local/sbin/libdnet-1.11/include --with-dnet-libraries=/usr/local/lib
#make && make install
#ln -s /usr/local/lib/libdnet.1.0.1 /lib/libdnet.1
#snort -V