All hardware and software things including network, system, UI, maintaining tools and the information security field
3/28/2009
我要的是在USB上可以跑作業系統
昨天弄了好久看了很多如何製作live USB的文章,最後想想,這根本不是我要的阿!live USB是說可以讓USB drive跟 live CD一樣,但是我只是要裝作業系統在USB上阿,那不就直接安裝時硬碟選擇USB不就ok了,而且live USB還有容量限制呢。為何大家都在討論live USB。
3/27/2009
在windows下 製作 ubuntu live USB
1.download the sysinstall zip file and extract to some place.
2.insert your USB device and format to the FAT32.
3.use cmd and cd to the syslinux-3.72 directory. ex: cd C:\syslinux-3.61\win32
4.type the command: syslinux E: (E: is my usb drive location)
5.mount your ubuntu iso file.
6.copy all the file inside the dir isolinux to your USB drive.
7.goto your USB and rename files isolinux.cfg and isolinux.bin to syslinux.cfg and syslinux.bin.
8.restart your computer and set the bios to boot form USB.
9.finish.
2.insert your USB device and format to the FAT32.
3.use cmd and cd to the syslinux-3.72 directory. ex: cd C:\syslinux-3.61\win32
4.type the command: syslinux E: (E: is my usb drive location)
5.mount your ubuntu iso file.
6.copy all the file inside the dir isolinux to your USB drive.
7.goto your USB and rename files isolinux.cfg and isolinux.bin to syslinux.cfg and syslinux.bin.
8.restart your computer and set the bios to boot form USB.
9.finish.
12/24/2008
buffer overflow attack
最近為了課程上的興趣,做了一些測試
1. 先寫一個有system call的程式作為被攻擊的對象程式
2. 利用gdb 找到目的函式的位址(要跳過去執行的地方)
3. 發起buffer overflow attack(內含目的函式位址)
測試完發現一件奇怪的事情,就是不管有無開啟ASLR,這個攻擊都有效。原因可能是ASLR基本上是針對系統呼叫的函式的位址,去作隨機配置,而不是該受害程式的位址,所以不管有無ASLR,該受害程式還是會去呼叫內部libc,並且照常執行。 然而,這樣無法取得root shell。
(12/25) 今天跟老師討論一下,推斷可能是該ASLR機制只有針對某些區段或只對libc作randomize並沒有完全random,不過詳細還是要看用的ASLR是那一套機制。

1. 先寫一個有system call的程式作為被攻擊的對象程式
2. 利用gdb 找到目的函式的位址(要跳過去執行的地方)
3. 發起buffer overflow attack(內含目的函式位址)
測試完發現一件奇怪的事情,就是不管有無開啟ASLR,這個攻擊都有效。原因可能是ASLR基本上是針對系統呼叫的函式的位址,去作隨機配置,而不是該受害程式的位址,所以不管有無ASLR,該受害程式還是會去呼叫內部libc,並且照常執行。 然而,這樣無法取得root shell。
(12/25) 今天跟老師討論一下,推斷可能是該ASLR機制只有針對某些區段或只對libc作randomize並沒有完全random,不過詳細還是要看用的ASLR是那一套機制。

11/06/2008
把小紅傘的廣告視窗拿掉
小紅傘(antivir)是個頗為眾多人使用的防毒軟體,但是缺點是當他更新時會出現廣告,嘿嘿,不想讓他出現其實很簡單,只要進入軟體系統資料夾,通常是在C:\Program Files\Avira\AntiVir PersonalEdition Classic,再將 avnotify.exe 這個檔案刪除/移到其他資料夾就ok了。
目前測試是不會出現了,有問題請留言喔。
目前測試是不會出現了,有問題請留言喔。
note: 目前發現更新時還是會自動下載avnotify.exe檔,目前解決辦法為自己建立同樣檔名的檔案:avnotify.exe在該資料夾中,並且確定不會被覆寫。目前發現當系統重新啟動時,又會再次寫入該檔案,有和解決辦法嗎?
10/21/2008
ASLR 隨機記憶體編排 (linux)
ASLR (Address Space Layout Randomization)功能就是開機時載入程式在記憶體時,會放置在隨機的記憶體位址,所以每次執行一次程式,都會在不同的位置執行,讓駭客撰寫攻擊程式的難度變高,目前雖有一些破解方式,但是大多不是很有效率,
查詢是否開啟
sysctl -a|grep kernel.randomize_va_space
關閉的指令
sysctl -w kernel.randomize_va_space=0
因此可以減少電腦被入侵的機率。
在linux下啟動aslr方式:
sysctl -a|grep kernel.randomize_va_space
關閉的指令
sysctl -w kernel.randomize_va_space=0
開啟的指令
sysctl -w kernel.randomize_va_space=1
開機自動執行
在Fedora core 5
vim /etc/sysctl.conf

最近發現利用找到system()所在位址,就可以bypass ASLR,這樣會不會太簡單了!?
sysctl -w kernel.randomize_va_space=1
開機自動執行
在Fedora core 5
vim /etc/sysctl.conf

最近發現利用找到system()所在位址,就可以bypass ASLR,這樣會不會太簡單了!?
9/25/2008
7/23/2008
forgot mysql root password? don't worry!
如果忘記mysql密碼的話,可用下列方法解決:
# killall mysqld
# mysqld -u root --skip-grant-tables &
myaql (進入mysql)
>use mysql
>UPDATE user SET password=password('new password') where user='root';
>FLUSH PRIVILEGES;
這樣就完成了!
作業系統:ubuntu 7.04 (not suitable for every os)
# killall mysqld
# mysqld -u root --skip-grant-tables &
myaql (進入mysql)
>use mysql
>UPDATE user SET password=password('new password') where user='root';
>FLUSH PRIVILEGES;
這樣就完成了!
作業系統:ubuntu 7.04 (not suitable for every os)
7/15/2008
how to Install lamp (less than 20 min)
1.只要到 系統-> 管理-> synaptic套件管理員-> 編輯->以任務配置標記套件
把 LAMP Server 打勾
就安裝完成了,真是夠簡單了!
把 LAMP Server 打勾
2.在 synaptic套件管理員 ,單獨把 phpmyadmin 打勾
就安裝完成了,真是夠簡單了!
7/13/2008
Install RoR on ubuntu
1. sudo apt-get install ruby irb ri rdoc ruby1.8-dev2.2
2. sudo apt-get install rails
3. sudo apt-get install rubygems
6. rails name_of_app
2. sudo apt-get install rails
3. sudo apt-get install rubygems
4.sudo gem update
5.sudo gem install rails6. rails name_of_app
5/28/2008
常用 JAVA 資料型別轉換
1. 由 基本資料型態轉換成 String
String 類別中已經提供了將基本資料型態轉換成 String 的 static 方法
也就是 String.valueOf() 這個參數多載的方法
有下列幾種
String.valueOf(boolean b) : 將 boolean 變數 b 轉換成字串
String.valueOf(char c) : 將 char 變數 c 轉換成字串
String.valueOf(char[] data) : 將 char 陣列 data 轉換成字串
String.valueOf(char[] data, int offset, int count) :
將 char 陣列 data 中 由 data[offset] 開始取 count 個元素 轉換成字串
String.valueOf(double d) : 將 double 變數 d 轉換成字串
String.valueOf(float f) : 將 float 變數 f 轉換成字串
String.valueOf(int i) : 將 int 變數 i 轉換成字串
String.valueOf(long l) : 將 long 變數 l 轉換成字串
String.valueOf(Object obj) : 將 obj 物件轉換成 字串, 等於 obj.toString()
用法如:
int i = 10;
String str = String.valueOf(i);
這時候 str 就會是 "10"
2. 由 String 轉換成 數字的基本資料型態
要將 String 轉換成基本資料型態轉
大多需要使用基本資料型態的包裝類別
比如說 String 轉換成 byte
可以使用 Byte.parseByte(String s)
這一類的方法如果無法將 s 分析 則會丟出 NumberFormatException
byte :
Byte.parseByte(String s) : 將 s 轉換成 byte
Byte.parseByte(String s, int radix) : 以 radix 為基底 將 s 轉換為 byte
比如說 Byte.parseByte("11", 16) 會得到 17
double :
Double.parseDouble(String s) : 將 s 轉換成 double
float :
Double.parseFloat(String s) : 將 s 轉換成 float
int :
Integer.parseInt(String s) : 將 s 轉換成 int
long :
Long.parseLong(String s) : 將 s 轉換成 long
用法如:
try
{
String str = "1234";
int a = Integer.parseInt(str);
}
catch (NumberFormatException e)
{
System.out.println(" parse int error!! " + e);
}
String 類別中已經提供了將基本資料型態轉換成 String 的 static 方法
也就是 String.valueOf() 這個參數多載的方法
有下列幾種
String.valueOf(boolean b) : 將 boolean 變數 b 轉換成字串
String.valueOf(char c) : 將 char 變數 c 轉換成字串
String.valueOf(char[] data) : 將 char 陣列 data 轉換成字串
String.valueOf(char[] data, int offset, int count) :
將 char 陣列 data 中 由 data[offset] 開始取 count 個元素 轉換成字串
String.valueOf(double d) : 將 double 變數 d 轉換成字串
String.valueOf(float f) : 將 float 變數 f 轉換成字串
String.valueOf(int i) : 將 int 變數 i 轉換成字串
String.valueOf(long l) : 將 long 變數 l 轉換成字串
String.valueOf(Object obj) : 將 obj 物件轉換成 字串, 等於 obj.toString()
用法如:
int i = 10;
String str = String.valueOf(i);
這時候 str 就會是 "10"
2. 由 String 轉換成 數字的基本資料型態
要將 String 轉換成基本資料型態轉
大多需要使用基本資料型態的包裝類別
比如說 String 轉換成 byte
可以使用 Byte.parseByte(String s)
這一類的方法如果無法將 s 分析 則會丟出 NumberFormatException
byte :
Byte.parseByte(String s) : 將 s 轉換成 byte
Byte.parseByte(String s, int radix) : 以 radix 為基底 將 s 轉換為 byte
比如說 Byte.parseByte("11", 16) 會得到 17
double :
Double.parseDouble(String s) : 將 s 轉換成 double
float :
Double.parseFloat(String s) : 將 s 轉換成 float
int :
Integer.parseInt(String s) : 將 s 轉換成 int
long :
Long.parseLong(String s) : 將 s 轉換成 long
用法如:
try
{
String str = "1234";
int a = Integer.parseInt(str);
}
catch (NumberFormatException e)
{
System.out.println(" parse int error!! " + e);
}
5/26/2008
Java string , int conversion
1 如何將字串 String 轉換成整數 int?
A. 有兩個方法:
1). int i = Integer.parseInt([String]); 或
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();
注: 字串轉成 Double, Float, Long 的方法大同小異.
2 如何將整數 int 轉換成字串 String ?
A. 有參種方法:
1.) String s = String.valueOf(i);
2.) String s = Integer.toString(i);
3.) String s = "" + i;
注: Double, Float, Long 轉成字串的方法大同小異.
A. 有兩個方法:
1). int i = Integer.parseInt([String]); 或
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();
注: 字串轉成 Double, Float, Long 的方法大同小異.
2 如何將整數 int 轉換成字串 String ?
A. 有參種方法:
1.) String s = String.valueOf(i);
2.) String s = Integer.toString(i);
3.) String s = "" + i;
注: Double, Float, Long 轉成字串的方法大同小異.
訂閱:
文章 (Atom)