javascript วิธีการถอดรหัสแบบง่าย ๆ

นี้คือ code ถอดรหัสของ XXXX แห่งหนึ่ง

javascript:void(document.getElementById('code1').value=document.getElementById('code2').value);

ลองนึกดู การเข้ารหัสแบบไหนกัน ที่ถอดรหัสได้ง่ายเพียงนี้ (บางทีมันไม่น่าจะถูกเรียกว่าถอดรหัสด้วยซ้ำ น่าจะเรียกว่าส่วนแสดงรหัส)

wma player via javascript

หลงไปเจอ script นี้มาครับ หลักการทำงานก็คือ
1. วางชื่อไพล์เพลง (001.wma, 002.wma) ไว้ก่อน
2. ใช้ javascript สุ่มเลือกเพลง
3. กำหนดค่า url ของไพล์เพลง ( http://www.ilovemysassygirl.com/song/ )
4. กำหนดค่า ตัวควบคุมการเล่นเพลงของ object media player, กว้าง, สูง, เล่นอัตโนมัต, เล่นวนไปเรื่อย ๆ
5. ใช้ document.write สร้างโค้ด embed ของ object media player โดยใช้ข้อมูลที่กำหนดค่าไว้ใน ข้อ 3,4 ครับ

งานนี้ปรับเปลี่ยนโค้ดได้พอสมควรเลยครับ เช่น.
1. ตัวอย่างเป็นการเรียกไพล์เพลงขึ้นมาเล่น โดยไพล์เพลงอยู่บน server ของเราครับ เปลี่ยน url ใหม่ ให้ไปเรียกไพล์เพลงที่ server อื่น ( กรณีที่เรา หลง ไปเจอ link stream ไพล์เพลงบางตัวมานะครับ )

<div align="center">
<!-- Start WMA Player code --> 

  <SCRIPT LANGUAGE="JavaScript">
  var play_list = new Array ('001.wma', '002.wma'); // ใส่ชื่อของเพลงทั้งหมดครับ
  var rand=Math.floor((play_list.length)*Math.random());

  var path='http://www.ilovemysassygirl.com/song/ '; // ใส่ URL ของโฟลเดอร์ที่เก็บเพลง (ต้องมี / ปิดท้ายด้วย เช่น http://www.mywebsite.com/song/
  var width_p=210; /*  กำหนด ความกว้างของ ตัวเล่น เพลง */
  var height_p=45; /*  กำหนด ความสูงของ ตัวเล่น เพลง */
  var auto='true'; /* กำหนด auto start */
  var loop='true'; /* กำหนด loop */
  document.write('<object classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 width='+width_p+' height='+height_p+'><param name=FileName value='+path+play_list[rand]+'><embed src='+path+play_list[rand]+' pluginspage=http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/ width='+width_p+' height='+height_p+'></embed></object>');
</SCRIPT>
<!-- End WMA Player code -->
</div>

code breaker 11-08-53

ลักษณะการทำงานขั้นพื้นฐานของ code เป้าหมาย

If HTTP_USER_AGENT = Player_XXX Then
     print "Send Data."
Else
     print "Don't Send Data."
End If

ผลลัพธ์จากการใช้คำสั่ง : $_SERVER['HTTP_USER_AGENT'];

บราวเซอร์ตัวที่ 1

Browser : Chrome
Data : Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4

บราวเซอร์ตัวที่ 2

Browser : Player_XXX
Data :
NSPlayer/11.00.6000.6351 WMFSDK/11.00.6000.6351
NSPlayer/11.0.6000.6351 WMFSDK/11.0
Windows-Media-Player/11.0.6000.6353
NSPlayer/11.00.6000.6351 WMFSDK/11.00.6000.6351

จากข้อมูลเบื้องต้นทำให้รู้ว่า เราสามารถหยุดคำสั่งได้

เครื่องมือที่ใช้ : php (codeigniter)

การเก็บข้อมูล :

$data['data1'] = $_SERVER['HTTP_USER_AGENT'];
$data['data2'] = date('d m Y H:i:s');
$this->db->insert('tbl_b',$data);

การหยุดคำสั่ง :

$userAgent = "Firefox (WindowsXP) - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_VERBOSE, false);
$html= curl_exec($ch);

Code ต้นแบบ อ้างอิงจาก : http://www.phpdeveloping.co.za/curl/faking-your-user-agent-with-curl.html

Code ที่แก้ไขแล้ว :

$url = 'xxx://xxx.xxx.xxx.xxx/xxx/xxx.xxx';

$userAgent = "Windows-Media-Player/11.0.6000.6353";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_VERBOSE, false);
$html= curl_exec($ch);

$this->db->insert('tbl_b',array('data1'=>$html,'data2'=>date('d m Y H:i:s')));

ผลลัพธ์ที่ได้จาก Code ที่แก้ไขแล้ว

<asx version="3">
<title>xxx xxx</title>

<entry><Duration value = "xx:xx:xx" />
     <ref href="xxx://xxx.xxx.xxx.xxx/xxx/xxx.xxx" />
     <title>xxx</title>
</entry>

<entry><Duration value = "xx:xx:xx" />
     <ref href="xxx://xxx.xxx.xxx.xxx/xxx/xxx.xxx" />
     <title>xxx</title>
</entry>
...
...
...

</asx>

การนำผลลัพธ์ไปใช้ :
มีคนแนะนำให้ใช้ flashget, idm, orbit แต่ผมใช้ real player

การเพิ่มระดับการป้องกันของโค้ดเป้าหมาย : ไม่มีความเห็น

เรื่องนี้สอนให้รู้ว่า :
1. ระดับการป้องกัน  1 หลักการ 1 ชั้น
2. เพิ่มเติมส่วน Controller และ View เข้าไป จะได้เครื่องมือถอดรหัสอีกชุดหนึ่ง
3. สามารถนำโค้ดต้นแบบไปปรับปรุง แล้วลอบใช้ resource ได้

Get Adobe Flash playerPlugin by wpburn.com wordpress themes