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.

Sending string with multiple line across botnet

Old posts that have not been replied to for several years.
Locked
T
TimeLord
Voice
Posts: 18
Joined: Thu Apr 03, 2003 7:48 am

Sending string with multiple line across botnet

Post by TimeLord »

Hello, i need to send message to another bot using "putbot". I need to include variable $dccsend, but only first line going out. Here is my last try:

Code: Select all

set dccsend [join [list [dcclist SEND]]]
common output from this comand is like:
Tcl: {8 {BOTSNAME} SYS@268AFA0.com SEND {send (361945012)/734447616
Tcl: Filename: file1.zip
Tcl: } 1081837810}

How to send all 3 lines to another bot please ?
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

use the 'foreach' command:

Code: Select all

proc dcc:sends {} {
  set dccsend [join [list [dcclist SEND]]]
  set send2 ""
  foreach send $dccsend {
    append send2 "$send"
  }
  putlog "$send2"
}
Should work, but not tested :P
Xpert.
T
TimeLord
Voice
Posts: 18
Joined: Thu Apr 03, 2003 7:48 am

Post by TimeLord »

Thanx very much. Now im thinkin` about how to remove "{}" characters from this variable and then send only botname, filename and progress.

output from dcclist command is string or list ???
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

To remove the "{,}" you should use the regsub command.
regsub -all "\{" $dccsend "" dccsend
regsub -all "\}" $dccsend "" dccsend
Your code should be like that:

Code: Select all

proc dcc:sends {} { 
  set dccsend [join [list [dcclist SEND]]] 
  set send2 ""
  regsub -all "\{" $dccsend "" dccsend
  regsub -all "\}" $dccsend "" dccsend
  foreach send $dccsend { 
    append send2 "$send" 
  } 
  putlog "$send2" 
}
:P
Xpert.
T
TimeLord
Voice
Posts: 18
Joined: Thu Apr 03, 2003 7:48 am

Post by TimeLord »

yup, i just realized that

Code: Select all

regsub -all "\}|\{|send|SEND"  $conn "" conn 
workin` for me, but i can`t remove ( ) parentheses :-( in one line

Code: Select all

regsub -all "\}|\{|send|SEND|\(|\)"  $conn "" conn 
won`t work

if im usin` multiple line

Code: Select all

                regsub -all "\(" $conn "" conn
                regsub -all "\)" $conn "" conn     

then:
Tcl error [rcv_cmd]: couldn't compile regular expression pattern: parentheses () not balanced
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

I think you can remove the "/" in "(,)".
try:

Code: Select all

regsub -all "(" $conn "" conn 
regsub -all ")" $conn "" conn
:P
Xpert.
T
TimeLord
Voice
Posts: 18
Joined: Thu Apr 03, 2003 7:48 am

Post by TimeLord »

Xpert wrote:I think you can remove the "/" in "(,)".
try:

Code: Select all

regsub -all "(" $conn "" conn 
regsub -all ")" $conn "" conn
:P
same error :
Tcl error [rcv_cmd]: couldn't compile regular expression pattern: parentheses () not balanced
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

You need to get the list/string buisness right!
dcclist ?type?
Returns: a list of active connections, each item in the list is a
sublist containing six elements:
{<idx> <handle> <hostname> <type> {<other>} <timestamp>}.


The types are: chat, bot, files, file_receiving, file_sending,
file_send_pending, script, socket (these are connections that have
not yet been put under 'control'), telnet, and server. The timestamp
is in unixtime format.
Module: core

Code: Select all

proc dcc:sends {} { 
  set dccsend [dcclist SEND]
  foreach send $dccsend { 
    putlog "[join $send]" 
  } 
}
Elen sila lúmenn' omentielvo
T
TimeLord
Voice
Posts: 18
Joined: Thu Apr 03, 2003 7:48 am

Post by TimeLord »

Ok, script is finalized, please teach me how to simplify it :-) Objective is get file transfers curently on bot on another network and report it via linked bot to main network.

Code: Select all

proc rcv_cmd {from comm com} {
global linkbot dccstat
  
        if {[lindex $com 0] == "STATUS" } {
        set dccstat [dcclist SEND]
                if {$dccstat == ""} {
                putbot $linkbot "REL DCC status: Nothing in transfer queue"
                return 0
                }
                foreach conn $dccstat {
                regsub -all "\}|\{|send|SEND"  $conn "" conn
                regsub -all "\n"  $conn {} conn

set from [lindex $conn 1]
set file [lindex $conn 5]
set progres [split [lindex $conn 3] / ]
regsub -all -- {[^ A-Za-z0-9]} [lindex $progres 0] "" down
set all [expr [lindex $progres 1]/1048576]
set down [expr $down/1048576]
set progres "[expr ($down *100) / $all]%"

putbot $linkbot "REL DCC status: $from:\0034 $file $progres ($down MB/$all MB)" 
 
                }
        }
} 
Locked