2011年5月28日 星期六

兩行reg碼進行系統防寫

日前教授在部落格放了一個隨身碟防寫小軟體,學生捉了後其實有點驚嚇到...因為圖示打了個大叉叉,猶豫了許久打開了該軟體竟然又亂碼,所以稍微找了下,看到電腦不難部落格有reg改法如下:

防寫:


解除:


事實上只要將以上內容貼入記事本並且選擇存檔類型為"所有檔案"另存為『lockusb.bat』與『unlockusb.bat』即可。
如此一來就有兩個方便開關的執行檔,也不用擔心這個程式到底有沒有問題,畢竟只是兩行純文字...。

使用方法:
1.插入隨身碟前執行防寫命令。

懶人用...防寫解除

本人僅在XP測試,至於Vista、Windows7不曉得是否也行的通。

2011年5月10日 星期二

MDE電腦教室防隨身碟病毒小工具(已無效)

聲明:
本工具只能建立阻擋病毒侵入隨身碟的資料夾,
病毒清單是我大學到研究所蒐集同學們隨身碟曾經中過的病毒而來,
因此不能保證所有病毒都能夠阻擋,
原理很簡單,就是利用微軟BUG來創造無法刪除的資料夾。


用法:
1. 需要一顆正常還沒遭受病毒污染,純樸的隨身碟。
2. 把小工具解壓縮到隨身碟根目錄,假設你在Q槽,就請放在Q槽。
3. 請輕輕點兩下小工具並鍵入數字 1 後按下ENTER。
4. 沒了。
5. 就說沒了咩...
6. 不想用就鍵入 2 按下ENTER ~


載點:
SafeUSB.zip


後記:
因為Yen老師灌的第二個系統非常乾淨,
這個工具已經很久很久都沒有拿出來用,
但是前陣子教授有說過其它老師在它裝的系統亂灌軟體,
導致這個系統也開始變得不健康,
今天又剛好有同學晚上輔導中了頭獎,
所以我這個抵抗隨身碟病毒的工具只好再拿出來用了-.-


PS:有中毒的同學可以把你的病毒檔案名稱提供給我進行改版。


2011.5.17補充:
電腦教室有更強的病毒,
現在這招已經擋不住啦~

java applet drawstar

畫星星函式
public void cad_drawstar(Graphics g,int x,int y,int r,int angle)
  {
        Graphics2D graph = (Graphics2D)g;
        double deg,temp1,temp2,temp3,temp4;
        deg=3.14159/180.0;
        double pt_x[] = new double[7]; //java 宣告陣列 格式
        double pt_y[] = new double[7];
        double ptt_x[] = new double[7];
        double ptt_y[] = new double[7];
        int i,j;
        for (i=0;i<7;i++){
          pt_x[i]=x+r*Math.sin(72.*deg*i+angle*deg); //sin cos 三角函數 使用格式 Math.
          pt_y[i]=y-r*Math.cos(72.*deg*i+angle*deg);
          temp1=Math.cos(54.*deg-72.*deg*i-angle*deg);
          temp2=Math.sin(54.*deg-72.*deg*i-angle*deg);
          temp3=Math.sin(18.*deg);
          temp4=Math.cos(36.*deg);
          ptt_x[i]=x+r*temp3*temp1/temp4;
          ptt_y[i]=y-r*temp3*temp2/temp4;
        }
        for (i=0;i<5;i++){
          graph.drawLine((int)pt_x[i],(int)pt_y[i],(int)ptt_x[i],(int)ptt_y[i]); 
          //graph.drawLine 內的點必須是 int 因此把double 等變數強制轉換
          j=i+1;
          graph.drawLine((int)ptt_x[i],(int)ptt_y[i],(int)pt_x[j],(int)pt_y[j]);
        }
    }

php call java in cmsimple
<?php
 function HelloWorldApp(){
  $output="<applet codebase=\"plugins/test\" code=\"HelloWorldApp\" height=\"500\" width=\"500\"></applet>";
  return $output;
 }
?>

2011年5月3日 星期二

Java Applet HTML 新舊版嵌入語法

Class 檔案嵌入

舊版 HTML4 :
<applet codebase="Hello/World" code="HelloWorld.class" height="500" width="500">
<param name="Number" value="1" />
</applet>

新版 HTML5 (測試階段):
<object type="application/x-java-applet" codebase="Hello/World" code="HelloWorld.class" height="500" width="500">
<param name="Number" value="9" />
</object>


Jar 檔案嵌入

舊版 HTML4 :
<applet archive="Hello/World" code="HelloWorld.jar" height="500" width="500">
<param name="Number" value="8" />
</applet>

新版 HTML5 (測試階段):
<object type="application/x-java-applet" archive="Hello/World" code="HelloWorld.jar" height="500" width="500">
<param name="Number" value="7" />
</object>

c php applet

c 將波浪寫入txt檔
#include <stdio.h>
#include <stdlib.h>
void helloworld(int e){
  FILE *fp1;
  fp1=fopen("output.txt","w");
  int s,point;
  for(s=1;s<=e;s++){
    fprintf(fp1,"Hello World"); //fprintf主要目的是供你將資料,以格式化方式寫入某檔案內
    /*fprintf( )和printf( )兩者唯一的差別是,
    printf( )會將資料列印在螢幕上,而fprintf( )會將資料列印在某個檔案內。*/
    for(point=1;point<=s;point++){
      fprintf(fp1,"!");
    }
    fprintf(fp1,"\n");
  }
  for(s=e-1;s>0;s--){
    fprintf(fp1,"Hello World");
    for(point=1;point<=s;point++){
      fprintf(fp1,"!");
    }
    fprintf(fp1,"\n");
  }
    fclose(fp1);
}
int main(int argc, char** argv) { //
    int number;
    if(argc > 1)
        number = (int)atoi(argv[1]);
    else
        number = 50;
    helloworld(number);
    return 0;
}

php 取得值並呼叫c執行檔
<?php
/**************************************************
 File:phpCallexe.php
 Name:執行exe
 Explain:呼叫C語言並執行
****************************************By QQBoxy*/

if(isset($_GET['n']))
 $num = $_GET['n'];
else
 $num = 20;

$cmd = exec('c1.exe '.$num);
execInBackground($cmd);
echo 'It OK!!';

//-------------------------------------------------------
function execInBackground($cmd) {
     if (substr(php_uname(), 0, 7) == "Windows"){
         pclose(popen("start /B ".$cmd."", "r"));
     }
     else {
         exec($cmd." ".$num." > /dev/null &"); 
     }
}
//-------------------------------------------------------
?>


import java.applet.Applet;
import java.awt.*;

// for Frame Exit
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;


public class HelloWorldApp extends Applet {

       Stroke drawingStroke = new BasicStroke(2);

       public void init()
   {

   }

   public void paint(Graphics g) {
            int i,p;
            String peakNumber = "";
            peakNumber = getParameter("peakNumber");
            if(peakNumber != null) {
                    // 轉成整數使用 Integer.parseInt()
                    // 轉為浮點數使用 Float.parseFloat()
                    p = Integer.parseInt(peakNumber);
            } else {
                    // 若 peakNumber 取不到值, 則內定為 5
                    p = 10;
            }
            
      Graphics2D graph = (Graphics2D)g;
      graph.setStroke(drawingStroke);
      graph.setPaint(Color.black);
             for(i=1;i<=p;i++)
             {
        graph.drawString("Hello World", 10, 10+i*20);
               printC(graph,i, 80, 10+i*20);
              }
             for(i=p-1;i>=1;i--)
             {
        //graph.drawString("Hello World", 10, 10+(10+10-i)*20);
               //printC(graph,i, 80, 10+(10+10-i)*20);
               graph.drawString("Hello World", 10, 20+10+(2*p-1)*20-20*i);
               printC(graph,i, 80, 20+10+(2*p-1)*20-20*i);
              }
   }

   public void stop()
   {

   }

         public void printC(Graphics g, int m, int x, int y){
            Graphics2D graph = (Graphics2D)g;
            int i;
            for(i=0;i<m;i++)
            {
      graph.drawString("!", x+i*10, y);
            }
          }

    public static void main(String[] args) {

        Frame frm = new Frame("我的主方法(函式)框架");
        Applet applet = new HelloWorldApp();

        frm.addWindowListener(new WindowAdapter()
        {
          public void windowClosing(WindowEvent e)
          {
            System.exit(0);
          }
        });

        frm.setSize(100, 100);
        frm.setVisible(true);

        // 將 applet 加入 Frame 中
        frm.add(applet);
        frm.setSize(300, 300);
        frm.setVisible(true);
        applet.init();
        } // 結束 main

        /* Command Lines
        int i = 0;
        for(i=1;i<=10;i++)
        {
            System.out.print("Hello World");
            printC(i);
            System.out.print("\n");
        }

        for(i=9;i>=1;i--)
        {
            System.out.print("Hello World");
            printC(i);
            System.out.print("\n");
        }
    }
    static void printC(int m){
        int i;
        for(i=0;i<m;i++)
        {
            System.out.print("!");
        }
    }
    */
} // 結束 HelloWorldApp class


java applet由php 取值給入
<applet code="HelloWorldApp" height="500" width="500">
 <param name="peakNumber" value="10" />
</applet>


import java.applet.Applet;
import java.awt.*;

public class HelloWorldApp extends Applet {
    Stroke drawingStroke = new BasicStroke(2);
    // static 變數才可以在各方法中共用
    String peakNumber = "";
    int number;
    public void init()
    {
        peakNumber = getParameter("peakNumber");
        if(peakNumber != null) {
            // 轉成整數使用 Integer.parseInt()
            // 轉為浮點數使用 Float.parseFloat()
            number = Integer.parseInt(peakNumber);
        } else {
            // 若 peakNumber 取不到值, 則內定為 5
            number = 5;
        }
    }

    public void paint(Graphics g) {
        int i;
        Graphics2D graph = (Graphics2D)g;
        graph.setStroke(drawingStroke);
        graph.setPaint(Color.black);
        for(i=1;i<=number;i++) {
            // 每一行向下增量 20 單位
            graph.drawString("Hello World", 10, 10+i*20);
            
            printC(graph,i, 80, 10+i*20);
        }
        for(i=number-1;i>=1;i--) {
            // 必須考慮前半部已經增量 number*20
            graph.drawString("Hello World", 10, 10+(number+number-i)*20);
            printC(graph,i, 80, 10+(number+number-i)*20);
        }
    }

    public void printC(Graphics g, int m, int x, int y){
        Graphics2D graph = (Graphics2D)g;
        int i;
        for(i=0;i<m;i++) {
            graph.drawString("!", x+i*10, y);
        }
        s(graph,20,20,15);
    }
    public void s(Graphics g, int x, int y, int s){
        Graphics2D graph = (Graphics2D)g;
        graph.drawLine(x, y, x+s, y);
        graph.drawLine(x+s, y, x+s, y+s);
        graph.drawLine(x+s, y+s, x, y+s);
        graph.drawLine(x, y+s, x, y);
    }
    public void square(Graphics g, int x, int y, int s){
        Graphics2D graph = (Graphics2D)g;
        graph.drawLine(x, y, x+s, y+s);
    }
}