Skip to content

Share an file to botnet : commands putfile/putallfile, bind file like putbot/putallbots, bind bot #1026

@ZarTek-Creole

Description

@ZarTek-Creole

Pastebin example

Hello, Do you know if it is possible to transfer / share a file between two bots via the partyline / botnet? I know it is ```
possible to share the userfile .. and for a specific file an idea?
<@geo> ZarTek: take a look at the filesys module perhaps?
<@geo> I don't know that it shares a file "between two bots", but what are you trying to do specifically?
Geo: I would like to transfer a file through the botnet. The goal is to share a configuration file of a TCL script from bot1 to bot2 by the botnet. As a message via putbot. something like a putfile <script-filename.conf>
It may not be implemented. I will reread the filesys module, in my memory it is useful for files via DCC on IRC.
I imagine that a solution could be to read the file on bot1 encrypt in base64 use a putbot. on bot2 capture the base64 message and decrypt to write the file.
<@geo> ZarTek: docs.eggheads.org, look at the documentation for the filesys module
<@geo> other than that, you probably want to load a Tcl script
<@geo> I'm trying to figure out the use case for doing such a thing though
<@geo> oh, you pasted it, I missed that line
<@geo> sorry!
<@geo> also, base64 isn't encryption, its encoding. If you're trying to protect the contents, that is mostly pointless
Yes, encoding sorry. the base64 would be to create the contents of the file in character string
The goal would be such that the userfile share a file from the hub to the slaves to share the information contained and load each bot. a duplication of a file from the hub on the slaves.
via the botnet and not via the dcc send.
Geo: Yes, I'm sorry if I express myself poorly in English. I don't speak English very well.
In the end, the idea is to be able to have a file sent from one robot to another using the botnet protocol. The interest may be various. In my case, it is to be able to send the updates of my tcl script from one robot to another and the configuration files of this one.

`# On the hub
proc update { } {
	putlog "update..."
	set leaf		"BOT2"
	set CURPATH		[file dirname [file normalize [info script]]]
	set FULLPATH	"$CURPATH/my_script.tcl"

	# * Sent file 'my_script.tcl' to all bot on the botnet
	putallfile	"update_systeme my_script.tcl"		$FULLPATH
	#### Output Commands
	### putallfile <message> <file>
	## Description: sends a file across the botnet to all bots. If no script intercepts the message on the other end, the message is ignored.
	## Returns: nothing

	# * Sent file 'my_script.tcl' to 'BOT2' on the botnet
	putfile	$leaf "update_systeme my_script.tcl "	$FULLPATH

	#### Output Commands
	### putfile <bot-nick> <message> <file>
	## Description: sends a file across the botnet to another bot. If no script intercepts the message on the other end, the message is ignored.
	## Returns: nothing
	## Module: core

}


# on the leaf

#### bind FILE
## triggered by a file coming from another bot in the botnet. The first word is the command and the rest becomes the text argument; flags are ignored.
## Syntaxe: bind file <flags> <command> <proc>
## proc: proc-name <from-bot> <command> <text> <fileID>
## Module: core

bind file - update_file update:file:from:botnet
proc update:file:from:botnet { bot cmd arg fileid } {

	# fileid : like [open "$CURPATH/my_script.tcl" r] on the hub

	set filename	[lindex $arg 1]

	putlog "UPDATE FILE: $filename"
	set number	0
	#
	# gets with two arguments returns the length of the line,
	# -1 if the end of the file is found
	#
	while { [gets $fileid line] >= 0 } {
		incr number
	}
	close $fileid

	putlog "Number of lines: $number"


}`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions