Archive for April, 2009
TCP connect() scanning is the most basic form of TCP scanning. The program performs a connect() command on those ports of the target machine which are to be checked. If the port is open then the connect() command will succeed and a connection will be established. If the port is closed the connect() function would [...]
April 30th, 2009 | Posted in C, Winsock, sockets | 1 Comment
TCP Connect Port Scanner works by trying to establish a connection with every port that is being scanned. If a connectio is established then the port is open otherwise closed.
The steps are simple :
April 28th, 2009 | Posted in C, Linux, sockets | No Comments
Regex can be used to convert all urls in a plain text into links i.e. with anchor tags.
Code :
function parse_links($str)
{
$str = str_replace(’www.’, ‘http://www.’, $str);
$str = preg_replace(’|http://([a-zA-Z0-9-\./]+)|’, ‘<a href="http://$1">$1</a>’, $str);
$str = preg_replace(’/(([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6})/’, ‘<a href="mailto:$1">$1</a>’, $str);
return $str;
}
?>
April 28th, 2009 | Posted in PHP | No Comments
Libpcap is a packe capture library which can be used to sniff packets or network traffic over a network interface. Pcap Documentation gives a description of the methods and data structures available in the libpcap library.
April 28th, 2009 | Posted in C, Linux, sockets | 1 Comment
To code a sniffer in C (Linux) the steps would be :
1. Create a Raw Socket.
2. Put it in a recvfrom loop.
A raw socket when put in recvfrom receives all incoming packets. The following code shows an example of such a sniffer. Note that it sniffs only incoming packets. For sniffing all traffic on a [...]
April 26th, 2009 | Posted in C, Linux, sockets | 1 Comment
The mail function of php can be used to send mails.
E.g.
$to = ‘recipient@example.com’;
$subject = ‘Hello This is the Subject’;
$body = ‘Hello This is the Body’;
if (mail($to, $subject, $body))
{
echo ‘Message Delivered’;
}
else
{
echo ‘Message delivery failed’;
}
April 23rd, 2009 | Posted in PHP | No Comments
MooCrop is a library which can be used to create a cropping interface in your webpage. With this library after a crop region is selected a php script can be called to crop the image on serverside. The moocrop interface provides four values that is the width , height , left and top of the [...]
April 23rd, 2009 | Posted in Javascript, PHP, mootools | No Comments
Hmmm, so it looks like that konqueror or dolphin wont access a windows ftp server properly whereas its absolutely fine and fast with linux ftp servers. One reason for this could be the NTLM authentication that windows ftp servers use.
April 17th, 2009 | Posted in Linux, Ubuntu | No Comments
As usual internet was fast on ubuntu as it used to be till I needed to plug more PCs into the adsl route lying nearby. After connecting all computers and the adsl router to a switch I noticed that on one of the PC (Ubuntu 8.04) internet became really slow. Rest of the 2 PCs [...]
April 15th, 2009 | Posted in Ubuntu | No Comments