「 プログラミング 」 一覧
-
-
【perl】perlコードを実行可能なままで圧縮し、元コードを隠す
zippack.pl
123456789101112131415161718192021222324252627282930use strict;use autodie;use IO::Compress::Gzip qw(gzip $GzipError);use File::Slurp;use File::Basename;#Ref: How to use Gzip/Gunzip#http://blog.livedoor.jp/moya_pro/archives/21566288.htmlunless ($ARGV[0]) {die "usage:". basename($0) ." inputfilename [>outputfilename]";}my $targetCode = read_file( $ARGV[0], { binmode => ':raw' } ) ;my $buf;gzip \$targetCode => \$buf or die "$GzipError";print "#This file is generated by ". basename($0) . ".\n";print "#Do not modify this file with a text editor.(or _DATA_ part will be broken.)\n";print <<'EOD';use IO::Uncompress::Gunzip qw(gunzip $GunzipError);my $code;my $zipcode = join('',map{$_}<DATA>);gunzip \$zipcode => \$code or die "$GunzipError";eval $code;if ($@) {die $@, "\n";}__DATA__EODbinmode(STDOUT);print $buf;圧縮後のスクリプトのスクショ 圧縮後スクリプトの実行結果 ※|moreは、くっつけると実行結果をペ …
-
-
【perl】2つのファイルの先頭Xバイトのxorを取るperlスクリプト
使用サンプル ↓raw_script.txtとxorist.txt(あらかじめxorしておいた)をこのスクリプトにかけた結果、0xC2でxorされていたことがわかる 用途 xorする前のファイルとxo …
-
-
【perl】入力ファイルに対して1バイトxorを行うスクリプト
出力先ファイル名、xorする値はソース中にベタ書き。
12345678910111213141516171819202122#1byte xoruse strict;our $key = pack("C*",0x33);#きちんとpackしないと結果がおかしくなるunless ($ARGV[0]) {print "usage: xorist.pl inputfilename";}#バイナリファイル読み込み ref:http://motivation.drivendevelopment.jp/2009-06-16-1.htmlmy $filename = $ARGV[0];open my $file,'<',$filename or die;binmode $file;open(OUT,">xorist_out.txt") or die;binmode(OUT);my $val;while(read($file, $val, 1)){my $byte = ($val ^ $key);print OUT $byte;}注意点メモ xor(^)の両辺は、数値なら数値、バイ …
-
-
必要になったので。自分用。 http://www.unira.org/test/md5.php?in=MD5関数への入力文字列 以下サンプル http://www.unira.org/test/md5 …