This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

.wget fot the wget command !?

Old posts that have not been replied to for several years.
Locked
Z
Zygomaticum

Post by Zygomaticum »

Hi.

I got a problem (again :smile:).
I'm making a .wget <url> command to use the linux command wget <url>.

My problem with doing this:
if i let wget download it without any dirchange, the file comes into /home/zygo/eggdrop (my eggdrop dir), but i want it in /home/zygo/temp
if i do it like this:
proc <name> {blablabla}{
set http [lindex $arg 0]
cd /home/zygo/temp
exec wget $http
}
it works, i get the file in the /home/zygo/temp dir, but when i rehash my eggdrop it quits with error: Config file not founded. (this error is because of the dirchange.)
even when i add the command
cd /home/zygo/eggdrop
or
cd /home/zygo/eggdrop/scripts
after the exec ... command, i still get the same error when rehashing.

Now i'm trying to do this by logging in again to the shell with ssh, but i get errors when my eggdrop has to enter the pass.
script i use for ssh loging in atm:

proc pub_wget {nick uhost hand chan arg} {
global sship sshlogin sshpass
set http [lindex $arg 0]
set sshclient [exec which ssh]
set ssh [open "|$sshclient -l $sshlogin $sship" w]
puts $ssh "$sshpass"
puts $ssh "cd /home/zygo/temp"
puts $ssh "wget $http"
putserv "NOTICE $nick :File $http successfully put in /home/zygo/temp."
puts $ssh "exit"
close $ssh
}

error i get:
[17:13] Userfile loaded, unpacking...
zygo@80.56.131.50's password:
zygo@80.56.131.50's password:
zygo@80.56.131.50's password:
[17:13] TCL error [pub_wget]: Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).

i still get this error when changing the line:
puts $ssh "$sshpass"
into:
puts $ssh $sshpass
and into:
puts $ssh "<passtypedout>"

can someone help me? :smile:

Thanx in advance, Zygo.
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

i'm too tired to figure out whats wrong, but be warned, the way you're writing it is a brilliant way for someone to take full control of your shell on your box that you're sshing to via shell meta characters.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Here's an idea.. instead of doing "cd /home/blah/temp" why don't you use the --output-document=FILE option for wget? Or, for even less of a change, use the --directory-prefix=PREFIX option:

wget --output-document=/home/baa/temp/sheep.zip someurl

wget --directory-prefix=/home/baa/temp someurl
Z
Zygomaticum

Post by Zygomaticum »

On 2001-12-27 13:20, Petersen wrote:
i'm too tired to figure out whats wrong, but be warned, the way you're writing it is a brilliant way for someone to take full control of your shell on your box that you're sshing to via shell meta characters.
this commands only works if you got the flag +F
the only one with that flag is me.

and stdragon, i'm trying it out now, didn't find those arguments with the wget -help command, already searched for something like this (but couldn't find it)

thx for the help guys :smile: (i'm just learning tcl, this is my 3rd day :smile:, the most things i'm getting from other tcl files, but this thing i couldn't find, nor something like this)

PS: if someone got a good link for a help page or howto or guide or whatever whould be very nice :smile:

Greejtz, Zygo.

<font size=-1>[ This Message was edited by: Zygomaticum on 2001-12-27 18:03 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Well, it is in the -help output from my wget http://www.ppslim.ukshells.co.uk/netbots/wget.help

The problem with your second mwthod of doing it, is that eggdrop re-routes the stdin, stdout and stderr to /dev/null, as 100% closure of them, makes Tcl a little nuts
User avatar
slennox
Owner
Posts: 593
Joined: Sat Sep 22, 2001 8:00 pm
Contact:

Post by slennox »

this commands only works if you got the flag +F
the only one with that flag is me.
Hopefully you're the only one with +m too, because a +m user can add +F to anyone unless you have a proc that filters the chattr command to prevent it.
Z
Zygomaticum

Post by Zygomaticum »

On 2001-12-28 04:54, slennox wrote:
this commands only works if you got the flag +F
the only one with that flag is me.
Hopefully you're the only one with +m too, because a +m user can add +F to anyone unless you have a proc that filters the chattr command to prevent it.
DoH

i'm not that stupid :smile:

It's just a private bot, unlinked, 1 user with +m and +n, and a few others with flags +h an +A or +B for some commands they're allowed to use.
User avatar
slennox
Owner
Posts: 593
Joined: Sat Sep 22, 2001 8:00 pm
Contact:

Post by slennox »

DoH

i'm not that stupid :smile:
I was :smile:
Z
Zygomaticum

Post by Zygomaticum »

LoL :smile:

that's dumb :razz:

but it's working now :smile:
g
guppy
eggdrop engineer
Posts: 199
Joined: Mon Sep 24, 2001 8:00 pm
Location: Canada
Contact:

Post by guppy »

exec wget <whatever> is bad also because it will cause your bot to block while the file is downloading -- if you download a bigger file your bot will begin to ping out from irc and such ..

a better way would be to exec wget <whatever> & but then you can't tell when the file is done or not ..

Not sure what would be a really good way

Jeff
Z
Zygomaticum

Post by Zygomaticum »

On 2001-12-28 19:33, guppy wrote:
Not sure what would be a really good way
use an seperate egg to exec the wget cmd :smile: (an egg that only does something on the .wget trigger)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Try the 'open' command, and then use a fileevent to see when the command is done.

Code: Select all

proc reader {fp} {
  gets $fp text
  # You can parse the $text var to get status information
  if {[eof $fp]} {
    # The program exited.
    close $fp
  }
}
set fp [open "|wget baa"]
fileevent $fp readable [list reader $fp]
Locked