«

»

Tem 15 2009

Expect ile POP3 parolası kontrolü

#!/usr/bin/expect

# DOSYA’DAN VERİLER ALINIYOR
set dosya [open “kullanicilar.txt” r]
set kullanicilar_liste [read $dosya]
close $dosya
set kullanicilar [ split $kullanicilar_liste \n ]

# GENEL TANIMLAMALAR
set alan “bilecik.edu.tr”
set sunucu “posta.bilecik.edu.tr”
set port “110”
set parolasi_ayni_kullanicilar “”


# HER KULLANICI İÇİN PAROLA DENEMESİ
foreach kullanici $kullanicilar {

# nokta işaretlerini silerek parola üretir
#regsub -all {\.} $kullanici {} parola

# nokta işareti ve öncesindekileri silerek parola üretir
#regsub -all {^.*\.} $kullanici {} parola

# nokta işareti ve sonrasındakileri silerek parola üretir
regsub -all {\..*$} $kullanici {} parola

spawn telnet $sunucu $port
expect “+OK”
send “USER $kullanici@$alan\n
expect “+OK”
send “PASS $parola\n
expect {
“+OK” {
#send_user “parola dogru\n”
set parolasi_ayni_kullanicilar $parolasi_ayni_kullanicilar\n$kullanici:$parola
puts “*****************************\n$kullanici:$parola\n*****************************\n
}
“ERR*” {
#send_user “parola hatali\n”
}
}
send “quit\n
puts “_______________________________\nParolası bulunan kullanıcılar:”
puts $parolasi_ayni_kullanicilar
puts “_______________________________”


Bad Behavior has blocked 20 access attempts in the last 7 days.