Year: 2014

ptitle-particle1

Perl – Sending Email with NET::SMTP using username and password

Perl – Sending Email with NET::SMTP using username and password First of all double check that Authen::SASL is an installed module.. If you are not getting emails this could be why – it doesnt provide an error that is understandable! #!/usr/bin/perl ### ENSURE Authen::SASL is installed use Net::SMTP; use strict; use warnings; my $host= ‘yourhostname’; […]
Read more

Fix Open Postfix Relay – Unauthenticated Email

If your mail server is left open, anyone can use your SMTP service to send mail, and spammers will use it. This can result in your server being blacklisted and extraneous use of system resources that neither benefit you nor your users. Postfix logoTo secure Postfix, there are a number of functions you can add […]
Read more

send: Cannot determine peer address

Looking into IO::Socket at http://search.cpan.org/src/GBARR/IO-1.2301/IO/Socket.pm reveals: [perl] sub send { @_ >= 2 && @_ <= 4 or croak ‘usage: $sock->send(BUF, [FLAGS, [TO]] +)’; my $sock = $_[0]; my $flags = $_[2] || 0; my $peer = $_[3] || $sock->peername; croak ‘send: Cannot determine peer address’ unless($peer); [/perl] So you have to take care that […]
Read more

Perl – Is a value decimal, real or a string?

Perl – Is a value decimal, real or a string? To validate if a number is a number using regex. [perl] $number = “12.3”; if ($number =~ /\D/) { print “has nondigits\n” } if ($number =~ /^\d+$/) { print “is a whole number\n” } if ($number =~ /^-?\d+$/) { print “is an integer\n” } if […]
Read more

Perl – Basic Fork Example

#!/usr/local/bin/perl   use strict; use warnings;   print "Starting main program\n"; my @childs;   for ( my $count = 1; $count <= 10; $count++) {         my $pid = fork();         if ($pid) {         # parent         #print "pid is $pid, parent $$\n";         push(@childs, $pid);         } elsif ($pid == 0) {                 # child                 sub1($count);                 exit 0;         } else […]
Read more

PHP – Basic Fork Example

<?   print "Starting main program\n"; $childs = array();   for ( $count = 1; $count <= 10; $count++) {         $pid = pcntl_fork();         if ( $pid == -1 ) {                 // Fork failed                           echo "Fork failed\n";                 exit(1);         } else if ( $pid ) {                 # parent                 #print "pid is $pid, parent $$\n";                 array_push($childs, $pid);         } […]
Read more

UNIX – Fork Explained

Mr. Peabody Explains fork() Introduction How Windows Does It How Unix Does It So Why Do People Want the Unix Way? How does it work in Perl? Introduction UNIX – Fork Explained Say, Mr Peabody. I was just reading through the Perl 5.6 release notes and noticed that a new function called fork() is now […]
Read more

Ubuntu – Which Process is Using a port?

Ubuntu – Which Process is Using a port? 1- Find what application/process is using the pro, type: sudo netstat -lpn |grep :8080 and press Enter. You will get an output similar to this one tcp6       0      0 :::8080                 :::*                    LISTEN      6782/java 2- I have got the process Id, which is 6782, now this is the […]
Read more

Heart Bleed – Exploit Example Code

Heart Bleed – Exploit Example Code If you need to test your server for the vulnerability, here is a simple Python script… [python] #!/usr/bin/python import sys import struct import socket import time import select import re from optparse import OptionParser options = OptionParser(usage=’%prog server [options]’, description=’Test for SSL heartbeat vulnerability (CVE-2014-0160)’) options.add_option(‘-p’, ‘–port’, type=’int’, default=443, […]
Read more
Cart

No products in the basket.