Perlで無理ゲーム攻略 (How to play Win32::GuiTest)
http://yapcasia.org/2011/talk/32
某MMORPGでゲーム中にPerlの同時起動を遮断する機能が追加されたことがありました。
Win32::GuiTest や Win32::Screenshot などのモジュールを利用して、Windows上で
動作するゲームを自動でプレイするPerlプログラムを作成する方法について解説します。
Once upon a time, perl.exe was banned during a game by MMORPG.
I will explain how to create the Perl bot program which plays
automatically games on Windows using some modules such as
Win32::GuiTest and Win32::Screenshot.
CTFとは、世界的に有名な旗取り合戦(Capture The Flag)のことで、セキュリティ技術を競うコンテストの総称です。出題ジャンルは、暗号、バイナリ、ネットワーク、Web、プログラミングなど多岐に渡り、クイズ形式の問題の謎を解いたり、実験ネットワーク内で疑似的な攻防戦を行ったりするものです。セキュリティだけでなくプログラミングに関する知見も問われ、攻撃技術、防御技術、解析技術、暗号の知見、ネットワーク技術など、広範な知識と経験が必要となっています。CTFは総合的な問題解決力を磨く最適な競技と言えるでしょう。
CTFには既に20年近い歴史があり、ラスベガスのDEFCONでCTFが開催されたことをきっかけに、今やヨーロッパやアジア、オセアニアや南米など、各国で頻繁に競技会が開催されています。国際大会も多く、元祖DEFCONを筆頭に、マレーシアHack in the BOXや、韓国CODEGATEなど、世界中からチームがCTFに参戦して熱戦を繰り広げています。
日本では2000年代の前半に「運動会」、それに続く「セキュリティスタジアム」が開催されましたが、現在に至るまで数年の空白期間があり、普及啓発や人材育成という面で世界に後れを取っているのが現状です。先日JNSA賞を受賞した日本チームsutegoma2の孤軍奮闘のおかげで昨年ようやくDEFCON CTFの世界予選を2位で突破しましたが、残念ながら本選ではふるわず、まだまだ世界とは大きな格差があると言わざるを得ません。
そんな中、今年SECCON CTF実行委員会を発足し、日本全体のセキュリティ技術の底上げと人材発掘をはかる目的で、国内でも本格的にCTF競技会を開催することとしました。
That Goes Without Alpha-Num (or Does It ?) all your base10 are belong to ustakesako
?
The document discusses various programming languages and their characteristics in a non-standard formatting without using typical alphanumeric characters.
(1) It examines MS-DOS 8086 assembly language programming and describes executing code on 16-bit x86 CPUs through binary instructions.
(2) It also examines JavaScript, Perl, Ruby and compares some of their common features like comment syntax and string interpolation.
(3) It then proposes executing x86 code without using binaries by manipulating the registers through hexadecimal subtraction and bitwise operations, though this method would be difficult to program and debug.
YAPC::Asia 2008 in Tokyo was the largest YAPC conference to date with over 500 attendees from 12 countries. It featured speakers in 3 rooms over 2 days in May and was organized by 12 individuals. Volunteers and sponsors helped ensure the event's success. The closing ceremony thanked attendees and expressed hope to see everyone again at the next YAPC conference.
(1) The document summarizes a talk on the latest JavaScript trends in Japan. It discusses things like polyglot programming using HTML, CSS, JavaScript and Perl in a GIF image, cross-domain access protocols using GIFs, and various JavaScript frameworks and tools developed in Japan.
(2) Several Japanese JavaScript projects are highlighted, including Mylingual.net for multilingual websites, AJAJA for server-side JavaScript, and Cycal for Ajax spreadsheets.
(3) The talk also featured lightning talks on topics like implementing a Java virtual machine in JavaScript and fast XPath engines for JavaScript in Internet Explorer and Safari 2.
19. SendKeys($keys)
Name Action Name Action
{BACKSPACE} Backspace {PRTSCR} Print screen
{BS} Backspace {RIGHT} Right arrow
{BKSP} Backspace {SCROLL} Scroll lock
{BREAK} Break {TAB} Tab
{CAPS} Caps Lock {UP} Up arrow
{DELETE} Delete {PAUSE} Pause
{DOWN} Down arrow {F1} Function Key 1
{END} End ... ...
{ENTER} Enter {F24} Function Key 24
{ESCAPE} Escape {SPC} Spacebar
{HELP} Help key {SPACE} Spacebar
{HOME} Home {SPACEBAR} Spacebar
{INSERT} Insert {LWI} Left Windows Key
{LEFT} Left arrow {RWI} Right Windows Key
{NUMLOCK} Num lock {APP} Open Context Menu
{PGDN} Page down Key
{PGUP} Page up
20. (2) FindWindowLike, GetWindowRect
?GetWindowText, GetClassName
use Win32::GuiTest qw(:ALL);
system("start calc.exe");
sleep(1);
my @id = FindWindowLike(undef,"^電卓","",undef,1);
my $id = $id[0];
print GetWindowText($id), "?n";
print GetClassName ($id), "?n";
my ($x1, $y1, $x2, $y2) = GetWindowRect($id);
print "($x1, $y1)->($x2, $y2)", "?n";
21. (3) Win32::Screenshot
?CaputureRect #=> Image::Magick object
use Win32::Screenshot qw(CaptureRect);
my $img = CaptureRect(20, 10, 800, 500);
print $img; # Image::Magick=ARRAY(0xbeef)
$img->Write("x.png"); # save
system("start x.png"); # view
22. (4) Win32::GuiTest & Win32::Screenshot
?Capture only “calc.exe” window
use Win32::GuiTest qw(:ALL);
use Win32::Screenshot qw(CaptureRect);
system("start calc.exe");
sleep(1);
my @id = FindWindowLike(undef,"^電卓","",undef,1);
my ($x1, $y1, $x2, $y2) = GetWindowRect($id[0]);
my $img = CaptureRect($x1,$y1, $x2-$x1,$y2-$y1);
$img->Write("x.png"); # save
system("start x.png"); # view
28. Win32::GuiTest::SendMouse($command)
{LEFTDOWN} left button down
{LEFTUP} left button up
{MIDDLEDOWN} middle button down
{MIDDLEUP} middle button up
{RIGHTDOWN} right button down
{RIGHTUP} right button up
{LEFTCLICK} left button single click
{MIDDLECLICK} middle button single click
{RIGHTCLICK} right button single click
{ABSx,y} move to absolute coordinate
{RELx,y} move to relative coordinate
38. FAQ. 役に立つの?
?新しいスクリーンセーバーとして鑑賞する
?Fun of the New Screen Saver
?タイピングソフトでハイスコアを出す
?Scoring champion for Key-Typing software
?Windowsアプリの自動テスト化
?Automation Testing for Win32 Applications
?セキュリティ脆弱性検査
?Fuzzing
?その他 etc.
49. How to Kill the process on Win32
?XP, 2003 Server …
?New command line tools
?tasklist
?プロセスを一覧表示する
?taskkill /F /IM notepad.exe
?プロセスを kill する
?成功: プロセス "notepad.exe" (PID 777) は強制終
了されました。