Archivo

Entradas Etiquetadas ‘perl’

win-get apt-get for windows

jueves, 9 de abril de 2009 Albertux Sin comentarios

win-get apt-get for windows

One thing I love of Debian is apt-get command, so why not have not the same, ok not the same but something similar run on Windows?, I search some projects on sf.net but don’t work or are not updated, so I made my own project and works fine:

You can download executable file and source file (perl script) on:
http://win-get.ayalasoft.net

Categories: network, web, windows Tags: ,

FTP for Developers

jueves, 29 de enero de 2009 Albertux 2 comentarios

FTP para Desarrolladores

En estos ejemplos se sube un archivo de texto plano para mejores implementaciones lea la API o la documentacion de cada lenguaje o comando

Curl:

curl -T filename -u username:password ftp://hostname/filename

Perl:

use Net::FTP;
$hostname = "localhost";
$username = "user";
$password = "pass";
$filename = "file.txt";
$ftp = Net::FTP->new($hostname);
$ftp->login($username,$password);
$ftp->put($filename);
$ftp->quit;

Manejo de errores usa “or die $@” (“$ftp>message” solo cuando el login haya funcionado)

PHP:

<?php
$hostname = "localhost";
$username = "user";
$password = "pass";
$filename = "file.txt";
$conn = ftp_connect($hostname);
ftp_login($conn, $username, $password);
ftp_put($conn,$filename,$filename,FTP_ASCII);
ftp_close($conn);
?>

Manejo de errores usando “if(!function)”

Python:

import ftplib
hostname = "localhost"
username = "user"
password = "pass"
filename = "file.txt"
ftp = ftplib.FTP(hostname)
ftp.login(username, password)
ftp.storlines("STOR " + filename, open(filename))
ftp.quit()

Manejo de errores usando “try”, “except” y “else”

Ruby:

require 'net/ftp'
host = 'localhost'
user = 'user'
pass = 'pass'
file = 'file.txt'
ftp = Net::FTP.new(hostname)
ftp.login(username,password)
ftp.puttextfile(filename)
ftp.close

Manejo de errores usando “begin”, “rescue”, “else”, “ensure” y “end”.

Win32 batch:

ftp -s:settings.txt hostname

settings.txt:

username
password
put filename
bye

Manejo de errores usando “if not %errorlevel%==0 goto :error”

Categories: network, unix/linux, web, windows Tags: , , , , ,

Send Fake Mail

viernes, 5 de diciembre de 2008 Albertux 6 comentarios

Send Fake Mail

Remember is very posible the mail was arrived on Junk Box.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/perl
# Script: fakemail.pl, Version 1.0  [2008-12-04]
# Author: Albertux (Alberto Isaac Ayala Esquivias)
# Web Author: http://Albertux.AyalaSoft.com
# FeedBack: <albertoi7@gmail.com>
# Description: Send fake mail.
# Licence: GPLv3
 
use strict;
use warnings;
 
# Chouse the host to connect on port 25
my $host='localhost';
 
# The vars
my @raw_data=<data>;
my ($mail1, $mail2, $name1, $name2, $subject, $data );
 
print "Fake Mail: ";
chomp($mail1 = <>);
print "Destiny Mail: ";
chomp($mail2 = <>);
print "Fake Name: ";
chomp($name1 = <>);
print "Destiny Name: ";
chomp($name2 = <>);
print "Subject: ";
chomp($subject = <>);
print "Data: ";
chomp($data = <>);
 
foreach(@raw_data) {
	$_ =~ s/MAIL1/$mail1/g;
	$_ =~ s/MAIL2/$mail2/g;
	$_ =~ s/NAME1/$name1/g;
	$_ =~ s/NAME2/$name2/g;
	$_ =~ s/SUBJECT/$subject/g;
	$_ =~ s/DATA/$data/g;
	$_ =~ s/\\n/\n/g;
}
 
print "mail send.\n";
 
open(STDOUT, "| telnet ".$host." 25 > /dev/null 2>&1");
foreach (@raw_data) {
	print STDOUT $_;
}
 
1;
 
__DATA__
mail from: MAIL1
rcpt to: MAIL2
data
From: NAME1 <mail1>
To: NAME2 <mail2>
Subject: SUBJECT
DATA
.
quit
Categories: network, security Tags: ,

TODO LIST 2009

lunes, 1 de diciembre de 2008 Albertux Sin comentarios

TODO LIST 2009

Read/Learn/Practice:

Python 2.6 (What’s New)
Perl 5 (Modules, Packages)
PHP (Changes, and news)
COBOL
.NET (C#, LINQ, (ok VB but not much))
Java (Im interested on Mobil Applications)
Haskell
Ruby (Im interested on Rails)
Parrot and Pugs
Gnu/Linux (Services and Bash)
BSD and OpenSolaris

Personal Projects 2009:

BSE (Blog’s Search Engine) (http://BSE.AyalaSoft.com)
Invoices PHP (Now is part of a Intranet) (http://valuacion.com.mx)
Forming one’s own business
And others ….

Lambda Functions on PHP 5.3.0:

 $lambda = function () { echo "Hello World!\n"; };

Parrot “Hello World” example:

.sub main
      print "Hello World!\n";
.end

COBOL “Hello World” example:

* Hello World Program
* GPL Copyleft Jonathan Riddell 2001
	IDENTIFICATION DIVISION.
	PROGRAM-ID.    hello.
	ENVIRONMENT DIVISION.
	DATA DIVISION.
 
	PROCEDURE DIVISION.
		DISPLAY "Hello ," WITH NO ADVANCING
		DISPLAY "World!"
		STOP RUN.

Haskell “Hello World” example:

putStrLn "Hello World!"

SQL File to PHP5 Classes (sql2class)

martes, 25 de noviembre de 2008 Albertux Sin comentarios

Archivo de SQL a Clases de PHP5 (sql2class)

(shell prompt) perl sql2class.pl database.sql > classes.php

Descargar sql2class-0.2.tar.gz sql2class-0.3.tar.gz

LLevo poco tiempo programando en Perl espero ampliar este script para que soporte otros lenguajes en un futuro

Con este post me despido del año 2008, hasta enero del 2009.

Categories: database Tags: , ,