2011年7月18日 星期一

Android - 撥號字串 android_secret_code

如何在Android中 撥號程式裡面 打入特別字串 就會出現測試模式
Android中 這個號碼有固定格式 *#*# 開頭,#*#*結尾的撥號字串

Ex:進入撥號程式,輸入*#*#4636#*#* 可以看到一個測試發佈文章應用
Step:1. AndroidManifest.xml添加Filter就可以


2. Write a class: TestingSettingsBroadcastReceiver

========================================
查看Phone的原始程式碼 SpecialCharSequenceMgr.java,
有一個函數專門處理*#*# 開頭,#*#*結尾的撥號字串。


Reference:
http://android.amberfog.com/?p=422
http://blog.csdn.net/learnrose/article/details/6223048

2011年7月15日 星期五

proguard 連結

ProGuard

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. Because ProGuard makes your application harder to reverse engineer, it is important that you use it when your application utilizes features that are sensitive to security like when you areLicensing Your Applications.


ProGuard is integrated into the Android build system, so you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode. Having ProGuard run is completely optional, but highly recommended.


http://catyku.pixnet.net/blog/post/14722500

2011年7月12日 星期二

Samba 開啟分享 筆記

不知道是從哪邊抓到了 蠻詳細的 保存下來
[Samba基本設定] -test on ubuntu 10.10 (OK)

1.目的
Linux Windows 的機器能共享資源。
所使用的 protocol SMB

2.所需套件
samba-common , samba 以及 samba-client
(
). service 的名稱為:smb
(
). samba 中,主要的 daemon smbd / nmbd ,各肩負不同的責任:
a. smbd
File and Printer Sharing
b. nmbd
Resource Browsing / WINS Server
相關紀錄檔(Log)檔在 /var/log/samba 下。

3.samba 的設定檔/etc/samba/smb.conf
其中以 # ; 為首的資料行被視為註解。

4.預設的設定檔,內有三段:
[global]
workgroup = __________ # Workgroup / Domain Name
server string = _________ #
說明文字
log file = /var/log/samba/%m.log # %m --> The NetBIOS Name of client host
security = user # Or Anonymous
encrypt password = yes
smb password file = /etc/samba/smbpasswd
netbios name = ________ #
若無指定,預設為 hostname

[homes]
comment = home Directories
browseable = no
writable = yes
valid users = %S # %S --> User
create mode = 0664
directory mode = 0775

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no # guest ok = yes
等同 public = yes
writable = no
printable = yes #
印表機特定選項

5.檢測 smb.conf
 # testparm

6.啟動 samba
# service smb [ status | start | stop | restart ]

[On ubuntu 10.10]

# service smbd [ status | start | stop | restart ]

7.查看特定主機分享出的資源:
# smbclient -L
主機之NetBIOS名稱

8.[nmblookup]
a.
要查詢在目前的區域網路上是否有哪台主機之 NetBIOS name 為某個字
時,可以使用 nmblookup ,如 # nmblookup NetBIOSName
b.
也可用來像某台 WINS server 查詢:
# nmblookup -U wins_server -R NetBIOSName

9.要讓使用者以 john 的身分來使用 samba server 上的資源時,步驟如下:
(
請留意 encrypt password = smb passwd file =)
a.
samba server 上建立帳號
b.
利用 smbpasswd -a john 設定 samba 的密碼
c.
利用 smbclient //host//homes -U john 測試

10.使用某 windows 網路上某台機器所分享出來的資源:
a. smbclient
資源名稱 -U 使用者名稱
# smbclient //hostname/test -U username
b.
windows 上的一個資源掛載(mount)過來
mount
# mount -t smbfs -o passwd=xxx //host/docs /mnt/samba
smbmount

11.請嘗試建立兩個 share
a. myshare
:讓所有人均可讀取。
b. rhce
:只有屬於 rhce 群組的使用者才可以存取。
[myshare]
path = /tmp/test
browseable = yes
public = yes
writeable = yes
[rhce]
path = /tmp/rhce
browseable = no
public = no
valid users = john , mary , @rhce
writeable = yes

12.利用 swat 來設定 samba

13.smbstatus 可用來顯示目前有多少客戶端正在使用本機所提供的 samba 服務