Wednesday, July 27, 2011

Windows XP schtasks command line utility

Windows XP includes a commandline admin utility named schtasks. Schtasks allows an administrator to create, delete, query, change, run and end scheduled tasks on a local or remote system.

Parameter List:

/Create : Creates a new scheduled task.

/Delete : Deletes the scheduled task(s).

/Query : Displays all scheduled tasks.

/Change : Changes the properties of scheduled task.

/Run : Runs the scheduled task immediately.

/End : Stops the currently running scheduled task.

/? : Displays this help/usage.

God Promises

Proverbs 3:5-6
New International Version (NIV)

5 Trust in the LORD with all your heart
   and lean not on your own understanding;
6 in all your ways submit to him,
   and he will make your paths straight.

Matthew 16:24-26
New International Version (NIV)

24 Then Jesus said to his disciples, “Whoever wants to be my disciple must deny themselves and take up their cross and follow me.
25 For whoever wants to save their life will lose it, but whoever loses their life for me will find it.
26 What good will it be for someone to gain the whole world, yet forfeit their soul? Or what can anyone give in exchange for their soul?

Isaiah 41:13
Romans 10:13

Phil 4:19
Psalm 121:7-8

Psalm 37:37
John 15:7

Psalm 119:9
Gal 6:9

Psalm 118:8
Eph 6:4

John 5:39
Rev 21:4

Luk 12:40
Prov 16:3

Matth 7:12
Pet 1 3:10

Psalm 40:4
Rom 6:23

Matth 6:34
Matth 5:6

Rom 5:1
Psalm 32:8

Matt 11:29
Cor 2 9:7

Prov 3:5
Matt 16:24

Luk 21:15
Deu 31:6

Jac 5:15
Isa 45:22

Tim 1 2:5
Psalm 135:6

Matthew 7:8
Matthew 5:10

Tim 2 4:7-8
Rev 3:5

Heb 12:11
John 1 5:15

Psalm 92:10
Lam 3:22-23

Num 6:26
Isa 1:18

John 3:16
Isa 40:29

Pro 10:9
Pro 28:10

John 14:6
Psalm 7:10

Rom 6:23
Psalm 40:4

John 8:36
Psalm 115:14

Psalm 18:32
1st John 2:28

Matt 7:12
1 Pet 3:10

Luk 21:15
Deut 31:6

Matt 11:28
Prov 11:24

Psalm 18:32
1 John 2:28

Psalm 37:3
Revelations 22:12

1 John 3:1
Psalm 23

Mark 10:45
Prov 10:29

Psalm 103:17
Ephes 6:3

Matthew 5:11
Matthew 7:11

Isa 59:1
John 14:27

Psalm 40:4
Rom 6:23

Isa 58:11
1 John 2:1

John 15:7
Psalm 37:37

Rev 3:20
John 5:24

Prov 4:23
Matthew 18:20

Jer 33:3
Matt 6:33

Psalm 37:25
Rev 22:21

1 John 2:17
Psalm 3:5

James 1:12
Ecles 11:1-8

Luke 12:27
Proverbs 11:21

Proverbs 11:24
Matthew 11:28

Hebrews 12;11
1 John 5:15

Isaiah 59:1
John 14:27

1 John 5:14
Hebrews 11:6

Revelations 3:12
Hebrews 8:12

2 Cor 5:21
Isaiah 51:12

Psalm 18:32
1 John 2:28

Psalm 125:1
2 Tes 3:3

1 John 2:17
Psalm 3:5

Psalm 121:7-8
Phil 4:19

Psalm 7:10
John 14:6

Deuteronomio 4:40
John 12:26

Revelations 3:5
2 Timo 7-8

Proverbs 11:24
Matthew 11:28

1 Tim 2:5
Psalm 135:6

Proverbs 3:5
Matthew 16:24

Hebrews 10:38
1 John 5:13

Ephesians 2:8
Psalm 67:1

Psalm 121 7:8
Philippians 4:19

Isaiah 51:12
2 Cor 5:21

Psalm 37:3
Revelations 22:12

Psalm 40:4
Rom 6:23

Psalm 2:8
2 Peter 3:13

1 Juan 4:12
Exodo 33:14

Matthew 6:34
Matthew 5:6

Mat 7:7
Mat 5:8

1 Tim 2:5
Porque hay un solo Dios, y un solo mediador entre Dios y los hombres, Jesucristo hombre,
Psalm 135:6
Todo lo que Jehová quiere, lo hace, En los cielos y en la tierra, en los mares y en todos los abismos.

John 14:23
Eph 5:14

Rev 3:20
John 5:24

1 John 2:28
Psalm 18:32

Mat 11:29
2 Cor 9:7

Gen 8:22
Heb 4:12

Isaiah 45:22
James 5:15

1 John 2:17
Psalm 3:5

Delete route in Fedora

route del -net 172.16.9.0 netmask 255.255.255.0 eth3

Tuesday, July 26, 2011

Using Windows Script for sending keys to an application

Open the calculator and show the About message for 3 seconds:


Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("calc")
WScript.Sleep(100)
WshShell.AppActivate("Calculator")
WScript.Sleep(100)
WshShell.SendKeys("%H")
WScript.Sleep(500)
WshShell.SendKeys("{DOWN}")
WScript.Sleep(100)
WshShell.SendKeys("~")
WScript.Sleep(3000)
WshShell.SendKeys("{ESC}")

Close the Calculator:


Set WshShell = WScript.CreateObject("WScript.Shell")
Result = WshShell.AppActivate("Calculator")
WScript.Sleep(100)
If Result = True Then
WshShell.SendKeys "%{F4}"
End If

References:
http://technet.microsoft.com/en-us/library/ee156592.aspx
http://msdn.microsoft.com/en-us/library/8c6yea83(v=vs.85).aspx

Monday, July 25, 2011

Reading pcap files with Python

#!/usr/bin/python

import sys
import pcapy
from impacket import ImpactDecoder, ImpactPacket
import re

def main(argv):

        try:
                cap = pcapy.open_offline(argv[1])

                (header, payload) = cap.next()

                while header:
                        (seconds, micros) = header.getts()

                        # Parse the Ethernet packet
                        decoder = ImpactDecoder.EthDecoder()
                        ether = decoder.decode(payload)

                        # Parse the IP packet inside the Ethernet packet
                        iphdr = ether.child()

                        # Parse the TCP packet inside the IP packet
                        tcphdr = iphdr.child()

                        # Get the source and destination IP addresses
                        src_ip = iphdr.get_ip_src()
                        dst_ip = iphdr.get_ip_dst()

                        if tcphdr.child() <> None:
                                body = tcphdr.child().get_packet()

                                isFIX = re.match('8=FIX', body)
                                if isFIX <> None:
                                        print "%d.%06d %s" % (seconds, micros, body)

                        (header, payload) = cap.next()

        except pcapy.PcapError:
                pass

if __name__ == "__main__":
        main(sys.argv)

Wednesday, July 20, 2011

Date formatting in Perl

use Date::Format;
my $Time = time2str("%D", time());

Give something like 07/20/11

Package libtimedate-perl (in hardy, Ubuntu 8.04.3 LTS)

dpkg -S Date::Format

Sending a text file in the body of an email using Perl

In Perl there is a package called Mail::Sendmail that could be used to send a simple text message.

The package for the module is libtimedate-perl (in hardy, Ubuntu 8.04.3 LTS)

dpkg -S Mail::Sendmail

#!/usr/bin/perl

use strict;
use warnings;

use Mail::Sendmail;

# Read the file into a string to put it into the mail hash variable
open FH, 'file.txt' or
        die "Error reading file.txt file: $!\n";
my @Lines = ;
chomp @Lines;
close FH;
my $Lines = join "\n", @Lines;

my $Recipients = 'somebody@mail.example';

my $Subject = 'Testing mail in Perl';

my %mail = (
        To => $Recipients,
        From => 'testing@mail.example',
        Subject => $Subject,
        Message => $Lines
);

$mail{Smtp} = 'mail.example';

if (sendmail %mail) {
        print "Mail sent OK.\n"
} else {
        print "Error sending mail: $Mail::Sendmail::error \n"
}

print "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log;

__END__