Tag Archives: gnu gpl

[perl] Download video from Socialcam

หัดเขียนครับ ผิดพลาดขออภัย ^^”
#!/usr/bin/perl
#########################################################################
# ░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ██████▄▄█░░░░░██████▄░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
#example : ~$perl socialcam http://socialcam.com/v/z8hnY0ZJ?autostart=true#_=_
use LWP::Simple;
$ua = LWP::UserAgent->new();
chomp($file=shift);
$contents = $ua->get($file);
$found = $contents->content;
if($found =~ m/ `wget $1`;
}

[Perl] Encode & Decode MD5 : GUI

เป็นโปรแกรม Perl ตัวแรกนะครับที่ผมเขียนเป็นแบบ GUI ถ้าผิดพลาดประการใดก็ขออภัยด้วยครับ (-/\-)
ปล. ด้านล่างไม่ใช่รูปของโปรแกรมนี้นะครับ ส่วนของโปรแกรมนี้มีแค่ En&De md5 แค่นั้น 55 ^^"


#!/usr/bin/perl -w
#########################################################################
# ░░░░░░░░░░░░░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ███████░░░░░██████░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
use Tk;
use LWP;
use Digest::MD5 qw(md5_hex);
$mw = new MainWindow; $mw->geometry('300x150'); $mw->title("Perl GUI");

########## Encode MD5 ##########
$en_md5 = $mw->Label(-text => “Encode MD5”)->pack;
$mw -> Entry(-textvariable => \$put_en_md5) -> pack;
$mw->Button(-text => “Gen”, -command => \&en_md5 )->pack;

sub en_md5 {
my $md5_hash = $put_en_md5;
my $md5_generated = md5_hex($md5_hash);
print “Encode MD5 : Result => $md5_generated\n”;
########## Create New Form ##########
$mw = new MainWindow; $mw->geometry(‘350×70’); $mw->title(“Encode MD5 : Result”);
$mw->Label(-text => “$put_en_md5”)->pack;
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => $md5_generated) -> pack (-ipadx => 60,-ipady => 5);
}
########## Decode MD5 ##########
$de_md5 = $mw->Label(-text => “Decode MD5”)->pack;
$mw -> Entry(-textvariable => \$put_de_md5) -> pack;
$mw->Button(-text => “Gen”, -command => \&de_md5 )->pack;

sub de_md5 {
my $md5 = $put_de_md5;
$lwp = LWP::UserAgent->new;
$lwa = $lwp->get(‘http://md5.rednoize.com/?p&s=md5&q=’.$md5);
$hash = $lwa->content;
print “Decode MD5 : Result => $hash\n”;
########## Create New Form ##########
$mw = new MainWindow; $mw->geometry(‘350×70’); $mw->title(“Decode MD5 : Result”);
$mw->Label(-text => “$put_de_md5”)->pack;
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => $hash) -> pack (-ipadx => 60,-ipady => 5);
}
MainLoop;

[Perl] IP Information : GUI

SS :


#!/usr//bin/perl
#########################################################################
# ░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░ Copyright (c) 2012 by sornram9254.com
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░
# ░░░░░░░░░░░█░░█░░░░░░░░░░░░░ This software is open source,
# ░░░░░░░░░░█░░░█░░░░░░░░░░░░░ licensed under the GNU/GPL,v3.0
# ░░░░░░░░░█░░░░█░░░░░░░░░░░░░
# ██████▄▄█░░░░░██████▄░░░░░░░ Basically,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ this means that you're allowed to modify and
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ distribute this software.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ However, if you distribute modified versions,
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░ you MUST also distribute the source code.
# ▓▓▓▓▓▓█░░░░░░░░░░░░░░█░░░░░░
# ▓▓▓▓▓▓█████░░░░░░░░░██░░░░░░ See http://www.gnu.org/licenses/gpl.html
# █████▀░░░░▀▀████████░░░░░░░░ for the full license.
#########################################################################
use Tk;
use LWP::Simple;
$mw = new MainWindow; $mw->title("Perl GUI :)"); $mw->geometry('200x70');
$mw->Label(-text => "IP Information")->pack;
$mw->Button(-text => "Check", -command => \&get_ip )->pack(-ipadx => 40,-ipady => 5);
sub get_ip {
my $ua = LWP::UserAgent->new();
my $contents = $ua->get('http://www.melissadata.com/lookups/iplocation.asp');
my $found = $contents->content;
while( $found =~ m/Your IP Address: (.*?)<\/span>/g ) {
$ip=$1;
print "IP : $1 \n";
$mw = new MainWindow; $mw->geometry('400x200'); $mw->title("Check IP : Result");
my $frm_name = $mw -> Frame() -> pack(); #New Frame
my $ent = $frm_name -> Entry(-text => "IP => $1") -> pack (-ipadx => 100,-ipady => 5);
#------------------------------------------------------------------------------------------------------------------------------------------
my $content = $ua->get('http://www.melissadata.com/lookups/iplocation.asp?ipaddress='.$ip)->content;
my ($isp) = ($content =~ m/ISP<\/td>(.*?) <\/b>/g);
print "ISP : $1 \n";
my ($city) = ($content =~ m/City<\/td>(.*?)<\/b>/g);
print "City : $1 \n";
my ($state) = ($content =~ m/State or Region<\/td>(.*?)<\/b>/g);
print "State or Region : $1 \n";
my ($country) = ($content =~ m/Country<\/td>(.*?)<\/b>/g);
print "Country : $1 \n";
my ($la1,$la2) = ($content =~ m/Latitude & Longitude<\/td>(.*?)  (.*?)<\/b>/g);
print "Latitude : $1 .::.::. Longitude : $2 \n";
my $ent = $frm_name -> Entry(-text => "ISP => $isp") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "City => $city") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "State or Region => $state") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "Country => $country") -> pack (-ipadx => 100,-ipady => 5);
my $ent = $frm_name -> Entry(-text => "Latitude => $la1 .::. Longitude => $la2") -> pack (-ipadx => 100,-ipady => 5);
#------------------------------------------------------------------------------------------------------------------------------------------
}
}
MainLoop;